platform/upstream/llvm.git
11 years agoAdd a 'count' field to the DWARF subrange.
Bill Wendling [Tue, 4 Dec 2012 06:21:27 +0000 (06:21 +0000)]
Add a 'count' field to the DWARF subrange.

The count field is necessary because there isn't a difference between the 'lo'
and 'hi' attributes for a one-element array and a zero-element array. When the
count is '0', we know that this is a zero-element array. When it's >=1, then
it's a normal constant sized array. When it's -1, then the array is unbounded.

llvm-svn: 169219

11 years agoAdd a 'count' field to the DWARF subrange.
Bill Wendling [Tue, 4 Dec 2012 06:20:49 +0000 (06:20 +0000)]
Add a 'count' field to the DWARF subrange.

The count field is necessary because there isn't a difference between the 'lo'
and 'hi' attributes for a one-element array and a zero-element array. When the
count is '0', we know that this is a zero-element array. When it's >=1, then
it's a normal constant sized array. When it's -1, then the array is unbounded.

llvm-svn: 169218

11 years agoAdd the last part that is needed for vectorization of if-converted code.
Nadav Rotem [Tue, 4 Dec 2012 06:15:11 +0000 (06:15 +0000)]
Add the last part that is needed for vectorization of if-converted code.
Added the code that actually performs the if-conversion during vectorization.

We can now vectorize this code:

for (int i=0; i<n; ++i) {
  unsigned k = 0;

  if (a[i] > b[i])   <------ IF inside the loop.
    k = k * 5 + 3;

  a[i] = k;          <---- K is a phi node that becomes vector-select.
}

llvm-svn: 169217

11 years ago[asan] add experimental -asan-realign-stack option (true by default, which does not...
Kostya Serebryany [Tue, 4 Dec 2012 06:14:01 +0000 (06:14 +0000)]
[asan] add experimental -asan-realign-stack option (true by default, which does not change the current behavior)

llvm-svn: 169216

11 years agoAdd a 'getCount' method to get the number of elements in the subrange.
Bill Wendling [Tue, 4 Dec 2012 06:12:44 +0000 (06:12 +0000)]
Add a 'getCount' method to get the number of elements in the subrange.

llvm-svn: 169215

11 years agoAdd 'using' declarations to suppress -Woverloaded-virtual warnings.
Matt Beaumont-Gay [Tue, 4 Dec 2012 05:41:27 +0000 (05:41 +0000)]
Add 'using' declarations to suppress -Woverloaded-virtual warnings.

llvm-svn: 169214

11 years agoMove all operand definitions into HexagonOperands.td
Jyotsna Verma [Tue, 4 Dec 2012 05:00:31 +0000 (05:00 +0000)]
Move all operand definitions into HexagonOperands.td

llvm-svn: 169213

11 years agoMove generic Hexagon subtarget information into Hexagon.td
Jyotsna Verma [Tue, 4 Dec 2012 04:29:16 +0000 (04:29 +0000)]
Move generic Hexagon subtarget information into Hexagon.td

llvm-svn: 169212

11 years agodocs: Fix broken link.
Sean Silva [Tue, 4 Dec 2012 03:45:27 +0000 (03:45 +0000)]
docs: Fix broken link.

llvm-svn: 169211

11 years agodocs: Fix dead link.
Sean Silva [Tue, 4 Dec 2012 03:30:36 +0000 (03:30 +0000)]
docs: Fix dead link.

Apparently Dinkumware are no longer hosting their nice reference
manuals. Thankfully, `cppreference.com` can fill that role well.

llvm-svn: 169210

11 years agordar://12329730 (2nd part, revised)
Shuxin Yang [Tue, 4 Dec 2012 03:28:32 +0000 (03:28 +0000)]
rdar://12329730 (2nd part, revised)

The type of shirt-right (logical or arithemetic) should remain unchanged
when transforming  "X << C1 >> C2" into "X << (C1-C2)"

llvm-svn: 169209

11 years agodocs: Convert ProgrammersManual to reST.
Sean Silva [Tue, 4 Dec 2012 03:20:08 +0000 (03:20 +0000)]
docs: Convert ProgrammersManual to reST.

Patch by Alexander Zinenko!

llvm-svn: 169208

11 years agoDocument the existence of -fsanitize=bounds.
Richard Smith [Tue, 4 Dec 2012 02:48:16 +0000 (02:48 +0000)]
Document the existence of -fsanitize=bounds.

llvm-svn: 169207

11 years ago[ASan] Do not build the interceptors that use ObjC blocks if the compiler does not...
Alexander Potapenko [Tue, 4 Dec 2012 02:41:47 +0000 (02:41 +0000)]
[ASan] Do not build the interceptors that use ObjC blocks if the compiler does not support blocks.
Need to define MISSING_BLOCKS_SUPPORT in this case at buildtime.

Patch by Jack Howarth <howarth@bromo.med.uc.edu>

llvm-svn: 169206

11 years ago<rdar://problem/12750060>
Greg Clayton [Tue, 4 Dec 2012 02:22:16 +0000 (02:22 +0000)]
<rdar://problem/12750060>

Add the ability to get a symbol or symbols by name and type from a SBModule, and also the ability to get all symbols by name and type from SBTarget objects.

llvm-svn: 169205

11 years agoMissing #include to pick up def'n of TerminalState.h.
Jim Ingham [Tue, 4 Dec 2012 01:57:57 +0000 (01:57 +0000)]
Missing #include to pick up def'n of TerminalState.h.

llvm-svn: 169203

11 years agoGet rid of a warning where functions in DNB.h were extern "C" when they don't need...
Greg Clayton [Tue, 4 Dec 2012 01:57:36 +0000 (01:57 +0000)]
Get rid of a warning where functions in DNB.h were extern "C" when they don't need to be anymore.

llvm-svn: 169202

11 years agoASan: add new interface functions - __asan_(un)poison_stack_memory. Calls to these...
Alexey Samsonov [Tue, 4 Dec 2012 01:38:15 +0000 (01:38 +0000)]
ASan: add new interface functions - __asan_(un)poison_stack_memory. Calls to these functions are inserted by the instrumentation pass in use-after-scope mode

llvm-svn: 169201

11 years agoASan: add initial support for handling llvm.lifetime intrinsics in ASan - emit calls...
Alexey Samsonov [Tue, 4 Dec 2012 01:34:23 +0000 (01:34 +0000)]
ASan: add initial support for handling llvm.lifetime intrinsics in ASan - emit calls into runtime library that poison memory for local variables when their lifetime is over and unpoison memory when their lifetime begins.

llvm-svn: 169200

11 years agoclang/test/Index/comment-objc-decls.m: Try to fix r169193, to add x86_64-darwin.
NAKAMURA Takumi [Tue, 4 Dec 2012 01:03:31 +0000 (01:03 +0000)]
clang/test/Index/comment-objc-decls.m: Try to fix r169193, to add x86_64-darwin.

llvm-svn: 169199

11 years agoSimplify code. No functionality change.
Jakub Staszak [Tue, 4 Dec 2012 01:00:52 +0000 (01:00 +0000)]
Simplify code. No functionality change.

llvm-svn: 169198

11 years agoStack Alignment: when creating stack objects in MachineFrameInfo, make sure
Manman Ren [Tue, 4 Dec 2012 00:52:33 +0000 (00:52 +0000)]
Stack Alignment: when creating stack objects in MachineFrameInfo, make sure
the alignment is clamped to TargetFrameLowering.getStackAlignment if the target
does not support stack realignment or the option "realign-stack" is off.

This will cause miscompile if the address is treated as aligned and add is
replaced with or in DAGCombine.

Added a bool StackRealignable to TargetFrameLowering to check whether stack
realignment is implemented for the target. Also added a bool RealignOption
to MachineFrameInfo to check whether the option "realign-stack" is on.

rdar://12713765

llvm-svn: 169197

11 years agoUse dyn_cast instead of isa and cast. No functionality change.
Jakub Staszak [Tue, 4 Dec 2012 00:50:06 +0000 (00:50 +0000)]
Use dyn_cast instead of isa and cast. No functionality change.

llvm-svn: 169196

11 years agoLoopVectorize.cpp: Suppress a warning. [-Wunused-variable]
NAKAMURA Takumi [Tue, 4 Dec 2012 00:49:34 +0000 (00:49 +0000)]
LoopVectorize.cpp: Suppress a warning. [-Wunused-variable]

llvm-svn: 169195

11 years agoFix whitespace.
NAKAMURA Takumi [Tue, 4 Dec 2012 00:49:28 +0000 (00:49 +0000)]
Fix whitespace.

llvm-svn: 169194

11 years agoTesting objective-C declarations embedded in
Fariborz Jahanian [Tue, 4 Dec 2012 00:47:33 +0000 (00:47 +0000)]
Testing objective-C declarations embedded in
<declaration> tag of Comment XML and fixed a
missing declaration of ivars private to @implementation
as result of the testing. // rdar://12378714

llvm-svn: 169193

11 years agoRemove the old TRI::ResolveRegAllocHint() and getRawAllocationOrder() hooks.
Jakob Stoklund Olesen [Tue, 4 Dec 2012 00:46:13 +0000 (00:46 +0000)]
Remove the old TRI::ResolveRegAllocHint() and getRawAllocationOrder() hooks.

These functions have been replaced by TRI::getRegAllocationHints() which
provides the same capabilities.

llvm-svn: 169192

11 years agoHave clang use LLVM IR's fast-math flags when in FastMath or FiniteMathOnly modes...
Michael Ilseman [Tue, 4 Dec 2012 00:36:06 +0000 (00:36 +0000)]
Have clang use LLVM IR's fast-math flags when in FastMath or FiniteMathOnly modes. Test cases included.

llvm-svn: 169191

11 years agoRemove VirtRegMap::getRegAllocPref().
Jakob Stoklund Olesen [Tue, 4 Dec 2012 00:35:59 +0000 (00:35 +0000)]
Remove VirtRegMap::getRegAllocPref().

Now that there can be multiple hint registers from targets, it doesn't
make sense to have a function that returns 'the' preferred register.

llvm-svn: 169190

11 years ago<rdar://problem/12798131>
Greg Clayton [Tue, 4 Dec 2012 00:32:51 +0000 (00:32 +0000)]
<rdar://problem/12798131>

Cleaned up the option parsing code to always pass around the short options as integers. Previously we cast this down to "char" and lost some information. I recently added an assert that would detect duplicate short character options which was firing during the test suite.

This fix does the following:
- make sure all short options are treated as "int"
- make sure that short options can be non-printable values when a short option is not required or when an option group is mixed into many commands and a short option is not desired
- fix the help printing to "do the right thing" in all cases. Previously if there were duplicate short character options, it would just not emit help for the duplicates
- fix option parsing when there are duplicates to parse options correctly. Previously the option parsing, when done for an OptionGroup, would just start parsing options incorrectly by omitting table entries and it would end up setting the wrong option value

llvm-svn: 169189

11 years agoUse MRI::getSimpleHint() instead of getRegAllocPref() in remaining cases.
Jakob Stoklund Olesen [Tue, 4 Dec 2012 00:30:22 +0000 (00:30 +0000)]
Use MRI::getSimpleHint() instead of getRegAllocPref() in remaining cases.

Targets can provide multiple hints now, so getRegAllocPref() doesn't
make sense any longer because it only returns one preferred register.
Replace it with getSimpleHint() in the remaining heuristics. This
function only

llvm-svn: 169188

11 years agoremove trailing whitespace
Michael Ilseman [Tue, 4 Dec 2012 00:29:55 +0000 (00:29 +0000)]
remove trailing whitespace

llvm-svn: 169187

11 years agoStack Alignment: move functions from header file MachineFrameInfo.h.
Manman Ren [Tue, 4 Dec 2012 00:26:44 +0000 (00:26 +0000)]
Stack Alignment: move functions from header file MachineFrameInfo.h.

No functional change for this commit. The follow-up patch will add more stuff to
these functions.

rdar://12713765

llvm-svn: 169186

11 years agoA few more build fixes for gcc 4.6:
Daniel Malea [Tue, 4 Dec 2012 00:23:45 +0000 (00:23 +0000)]
A few more build fixes for gcc 4.6:
- use const char* instead of char* as needed in ObjC language runtime plugin
- use int to iterate through enum (operator++ on enum not defined)
- use initializer list instead of inline initialization of const field

llvm-svn: 169185

11 years agoRuntimeDyld: Fix up r169178. MSVC doesn't like "or".
NAKAMURA Takumi [Tue, 4 Dec 2012 00:08:14 +0000 (00:08 +0000)]
RuntimeDyld: Fix up r169178. MSVC doesn't like "or".

llvm-svn: 169183

11 years agordar://12329730 (2nd part)
Shuxin Yang [Tue, 4 Dec 2012 00:04:54 +0000 (00:04 +0000)]
rdar://12329730 (2nd part)

 This change tries to simmplify E1 = " X >> C1 << C2" into :
  - E2 = "X << (C2 - C1)" if C2 > C1, or
  - E2 = "X >> (C1 - C2)" if C1 > C2, or
  - E2 = X if C1 == C2.

 Reviewed by Nadav. Thanks!

llvm-svn: 169182

11 years agoclang/test/Driver/fsanitize-blacklist.c: Mark it as XFAIL:cygming, due to PR12920.
NAKAMURA Takumi [Mon, 3 Dec 2012 23:29:49 +0000 (23:29 +0000)]
clang/test/Driver/fsanitize-blacklist.c: Mark it as XFAIL:cygming, due to PR12920.

llvm-svn: 169180

11 years agoAdd VirtRegMap::hasKnownPreference().
Jakob Stoklund Olesen [Mon, 3 Dec 2012 23:23:50 +0000 (23:23 +0000)]
Add VirtRegMap::hasKnownPreference().

Virtual registers with a known preferred register are prioritized by
RAGreedy. This function makes the condition explicit without depending
on getRegAllocPref().

llvm-svn: 169179

11 years agoRuntime dynamic linker for MCJIT should support MIPS BigEndian architecture.
Akira Hatanaka [Mon, 3 Dec 2012 23:12:19 +0000 (23:12 +0000)]
Runtime dynamic linker for MCJIT should support MIPS BigEndian architecture.
This small change adds support for that. It will make all MCJIT tests pass
in make-check on BigEndian platforms.

Patch by Petar Jovanovic.

llvm-svn: 169178

11 years agoClassic JIT is still being supported by MIPS, along with MCJIT.
Akira Hatanaka [Mon, 3 Dec 2012 23:11:12 +0000 (23:11 +0000)]
Classic JIT is still being supported by MIPS, along with MCJIT.
This change adds endian-awareness to MipsJITInfo and emitWordLE in
MipsCodeEmitter has become emitWord now to support both endianness.

Patch by Petar Jovanovic.

llvm-svn: 169177

11 years agoMinor tweaking to SmallVector static size.
Michael Ilseman [Mon, 3 Dec 2012 22:57:47 +0000 (22:57 +0000)]
Minor tweaking to SmallVector static size.

llvm-svn: 169176

11 years agominor renaming, documentation and cleanups.
Nadav Rotem [Mon, 3 Dec 2012 22:57:09 +0000 (22:57 +0000)]
minor renaming, documentation and cleanups.

llvm-svn: 169175

11 years agoFunctions in MipsCodeEmitter.cpp that expand unaligned loads/stores are dead
Akira Hatanaka [Mon, 3 Dec 2012 22:51:22 +0000 (22:51 +0000)]
Functions in MipsCodeEmitter.cpp that expand unaligned loads/stores are dead
code. Removing it.

Patch by Petar Jovanovic.

llvm-svn: 169174

11 years agoUse the new getRegAllocationHints() hook from AllocationOrder.
Jakob Stoklund Olesen [Mon, 3 Dec 2012 22:51:04 +0000 (22:51 +0000)]
Use the new getRegAllocationHints() hook from AllocationOrder.

This simplifies the hinting code quite a bit while making the targets
easier to write at the same time.

llvm-svn: 169173

11 years agoconstify the cost API
Nadav Rotem [Mon, 3 Dec 2012 22:47:12 +0000 (22:47 +0000)]
constify the cost API

llvm-svn: 169172

11 years agoIF-conversion: teach the cost-model how to grade if-converted loops.
Nadav Rotem [Mon, 3 Dec 2012 22:46:31 +0000 (22:46 +0000)]
IF-conversion: teach the cost-model how to grade if-converted loops.

llvm-svn: 169171

11 years agoFix test failure when building Clang with g++4.7 -- don't use a Twine temporary
Richard Smith [Mon, 3 Dec 2012 22:39:14 +0000 (22:39 +0000)]
Fix test failure when building Clang with g++4.7 -- don't use a Twine temporary
after its lifetime has ended!

llvm-svn: 169170

11 years agoImplement ARMBaseRegisterInfo::getRegAllocationHints().
Jakob Stoklund Olesen [Mon, 3 Dec 2012 22:35:35 +0000 (22:35 +0000)]
Implement ARMBaseRegisterInfo::getRegAllocationHints().

This provides the same functionality as getRawAllocationOrder() for the
even/odd hints, but without the many constant register arrays.

llvm-svn: 169169

11 years agoDefine store instructions with base+immediate offset addressing mode
Jyotsna Verma [Mon, 3 Dec 2012 22:26:28 +0000 (22:26 +0000)]
Define store instructions with base+immediate offset addressing mode
using multiclass.

llvm-svn: 169168

11 years ago[Support] Make FileOutputBuffer work on Windows.
Michael J. Spencer [Mon, 3 Dec 2012 22:09:52 +0000 (22:09 +0000)]
[Support] Make FileOutputBuffer work on Windows.

llvm-svn: 169167

11 years ago[Support][FileSystem] Fix open mode in resize_file on Windows.
Michael J. Spencer [Mon, 3 Dec 2012 22:09:31 +0000 (22:09 +0000)]
[Support][FileSystem] Fix open mode in resize_file on Windows.

llvm-svn: 169166

11 years agoRevert the header sort on this file.
Michael J. Spencer [Mon, 3 Dec 2012 22:07:00 +0000 (22:07 +0000)]
Revert the header sort on this file.

"Windows.h" includes <Windows.h> which defines a bunch of stuff it shouldn't
(even with all the restriction macros). We have no control over this file, so
make it's scope as small as possible.

llvm-svn: 169165

11 years agomoves doInitialization and doFinalization to the Pass class and removes some unreacha...
Pedro Artigas [Mon, 3 Dec 2012 21:56:57 +0000 (21:56 +0000)]
moves doInitialization and doFinalization to the Pass class and removes some unreachable code in MachineModuleInfo

reviewed by Evan Cheng <evan.cheng@apple.com>

llvm-svn: 169164

11 years agoAdd a getMemorySize() function for DenseSet.
Argyrios Kyrtzidis [Mon, 3 Dec 2012 21:46:21 +0000 (21:46 +0000)]
Add a getMemorySize() function for DenseSet.

llvm-svn: 169163

11 years agoadapt cloog codegen testcases to isl
Sebastian Pop [Mon, 3 Dec 2012 21:34:09 +0000 (21:34 +0000)]
adapt cloog codegen testcases to isl

llvm-svn: 169161

11 years agouse -polly-ast instead of -polly-cloog
Sebastian Pop [Mon, 3 Dec 2012 21:33:55 +0000 (21:33 +0000)]
use -polly-ast instead of -polly-cloog

llvm-svn: 169160

11 years agoexecute cloog specific testcases only with CLOOG_FOUND
Sebastian Pop [Mon, 3 Dec 2012 21:33:40 +0000 (21:33 +0000)]
execute cloog specific testcases only with CLOOG_FOUND

llvm-svn: 169159

11 years agoNow that we have a basic if-conversion infrastructure we can rename the
Nadav Rotem [Mon, 3 Dec 2012 21:33:08 +0000 (21:33 +0000)]
Now that we have a basic if-conversion infrastructure we can rename the
"single basic block loop vectorizer" to "innermost loop vectorizer".

llvm-svn: 169158

11 years agoSince this SmallVector immediately grows on the next line, don't waste stack space...
Michael Ilseman [Mon, 3 Dec 2012 21:29:36 +0000 (21:29 +0000)]
Since this SmallVector immediately grows on the next line, don't waste stack space. SmallVector is still needed due to existing APIs growing their arguments

llvm-svn: 169157

11 years agoFixed a crash in which we examined the extension of
Sean Callanan [Mon, 3 Dec 2012 21:28:37 +0000 (21:28 +0000)]
Fixed a crash in which we examined the extension of
a file name, whether the file name had an extension
or not.

<rdar://problem/12793152>

llvm-svn: 169156

11 years agoUse a struct to hold the /proc/self/maps buffer on Linux.
Alexander Potapenko [Mon, 3 Dec 2012 21:21:22 +0000 (21:21 +0000)]
Use a struct to hold the /proc/self/maps buffer on Linux.

llvm-svn: 169155

11 years agoAdd a new hook for providing register allocator hints more flexibly.
Jakob Stoklund Olesen [Mon, 3 Dec 2012 21:17:00 +0000 (21:17 +0000)]
Add a new hook for providing register allocator hints more flexibly.

The TargetRegisterInfo::getRegAllocationHints() function is going to
replace the existing mechanisms for providing target-dependent hints to
the register allocator: ResolveRegAllocHint() and
getRawAllocationOrder().

The new hook is more flexible because it allows the target to provide
multiple preferred candidate registers for each virtual register, and it
is easier to use because targets are not required to return a reference
to a constant array like getRawAllocationOrder().

An optional VirtRegMap argument can be used to provide target-dependent
hints that depend on the provisional assignments of other virtual
registers.

llvm-svn: 169154

11 years agoDefine load instructions with base+immediate offset addressing mode
Jyotsna Verma [Mon, 3 Dec 2012 21:13:13 +0000 (21:13 +0000)]
Define load instructions with base+immediate offset addressing mode
using multiclass.

llvm-svn: 169153

11 years agoAdd initial support for IF-conversion. This patch implements the first 1/3,
Nadav Rotem [Mon, 3 Dec 2012 21:06:35 +0000 (21:06 +0000)]
Add initial support for IF-conversion. This patch implements the first 1/3,
which is the legality of the if-conversion transformation. The next step is to
implement the cost-model for the if-converted code as well as the
vectorization itself.

llvm-svn: 169152

11 years agoFixes a compile warning and crash in the tests.
Manuel Klimek [Mon, 3 Dec 2012 20:55:42 +0000 (20:55 +0000)]
Fixes a compile warning and crash in the tests.

The necessity of this fix points to a problem with the design
of the addToken during the optimiation phase, which we need to address
in a much more principled way.

llvm-svn: 169151

11 years agoUpdate CLooG
Tobias Grosser [Mon, 3 Dec 2012 20:47:57 +0000 (20:47 +0000)]
Update CLooG

This cloog versions passes all tests with isl 0.11.

llvm-svn: 169150

11 years agoDefine unsigned const-ext predicates.
Jyotsna Verma [Mon, 3 Dec 2012 20:39:45 +0000 (20:39 +0000)]
Define unsigned const-ext predicates.

llvm-svn: 169149

11 years agoRemoving unnecessary 'else' statement from the predicates defined in HexagonOperards.td.
Jyotsna Verma [Mon, 3 Dec 2012 20:14:38 +0000 (20:14 +0000)]
Removing unnecessary 'else' statement from the predicates defined in HexagonOperards.td.

llvm-svn: 169148

11 years agoEliminate redundant bitwise operations when using a llvm/ADT/PointerUnion.
Argyrios Kyrtzidis [Mon, 3 Dec 2012 19:59:23 +0000 (19:59 +0000)]
Eliminate redundant bitwise operations when using a llvm/ADT/PointerUnion.

For comparison, with this code sample:

PointerUnion<int *, char *> Data;
PointerUnion<int *, char *> foo1() {
Data = new int;
return new int;
}
PointerUnion<int *, char *> foo2() {
Data = new char;
return new char;
}

Before this patch we would get:

define i64 @_Z4foo1v() uwtable ssp {
  %1 = tail call noalias i8* @_Znwm(i64 4)
  %2 = ptrtoint i8* %1 to i64
  %3 = load i64* getelementptr inbounds (%"class.llvm::PointerUnion"* @Data, i64 0, i32 0, i32 0), align 8
  %4 = and i64 %3, 1
  %.masked.i = and i64 %2, -3
  %5 = or i64 %4, %.masked.i
  store i64 %5, i64* getelementptr inbounds (%"class.llvm::PointerUnion"* @Data, i64 0, i32 0, i32 0), align 8
  %6 = tail call noalias i8* @_Znwm(i64 4)
  %7 = ptrtoint i8* %6 to i64
  %8 = and i64 %7, -3
  ret i64 %8
}

define i64 @_Z4foo2v() uwtable ssp {
  %1 = tail call noalias i8* @_Znwm(i64 1)
  %2 = ptrtoint i8* %1 to i64
  %3 = load i64* getelementptr inbounds (%"class.llvm::PointerUnion"* @Data, i64 0, i32 0, i32 0), align 8
  %4 = and i64 %3, 1
  %5 = or i64 %2, %4
  %6 = or i64 %5, 2
  store i64 %6, i64* getelementptr inbounds (%"class.llvm::PointerUnion"* @Data, i64 0, i32 0, i32 0), align 8
  %7 = tail call noalias i8* @_Znwm(i64 1)
  %8 = ptrtoint i8* %7 to i64
  %9 = or i64 %8, 2
  ret i64 %9
}

After the patch:

define i64 @_Z4foo1v() uwtable ssp {
  %1 = tail call noalias i8* @_Znwm(i64 4)
  %2 = ptrtoint i8* %1 to i64
  store i64 %2, i64* getelementptr inbounds (%"class.llvm::PointerUnion"* @Data, i64 0, i32 0, i32 0), align 8
  %3 = tail call noalias i8* @_Znwm(i64 4)
  %4 = ptrtoint i8* %3 to i64
  ret i64 %4
}

declare noalias i8* @_Znwm(i64)

define i64 @_Z4foo2v() uwtable ssp {
  %1 = tail call noalias i8* @_Znwm(i64 1)
  %2 = ptrtoint i8* %1 to i64
  %3 = or i64 %2, 2
  store i64 %3, i64* getelementptr inbounds (%"class.llvm::PointerUnion"* @Data, i64 0, i32 0, i32 0), align 8
  %4 = tail call noalias i8* @_Znwm(i64 1)
  %5 = ptrtoint i8* %4 to i64
  %6 = or i64 %5, 2
  ret i64 %6
}

llvm-svn: 169147

11 years agoSimplify this test a bit because DWARF emission/dumping on some platforms
Eli Bendersky [Mon, 3 Dec 2012 19:58:12 +0000 (19:58 +0000)]
Simplify this test a bit because DWARF emission/dumping on some platforms
is not yet good enough for more sophistication. The important goal of this
test is to make sure llc doesn't crash on this IR like it used to.

llvm-svn: 169146

11 years agoAdd 'getInt64Field()' method to get the signed integer instead of unsigned.
Bill Wendling [Mon, 3 Dec 2012 19:44:25 +0000 (19:44 +0000)]
Add 'getInt64Field()' method to get the signed integer instead of unsigned.

llvm-svn: 169145

11 years agoAdd Clang flags -fsanitize-blacklist and -fno-sanitize-blacklist. Make this flag...
Alexey Samsonov [Mon, 3 Dec 2012 19:12:58 +0000 (19:12 +0000)]
Add Clang flags -fsanitize-blacklist and -fno-sanitize-blacklist. Make this flag usable for ASan. Blacklisting can be used to disable sanitizer checks for particular file/function/object.

llvm-svn: 169144

11 years agoASan: add blacklist file to ASan pass options. Clang patch for this will follow.
Alexey Samsonov [Mon, 3 Dec 2012 19:09:26 +0000 (19:09 +0000)]
ASan: add blacklist file to ASan pass options. Clang patch for this will follow.

llvm-svn: 169143

11 years agoFix PR12942: Allow two CUs to be generated from the same source file.
Eli Bendersky [Mon, 3 Dec 2012 18:45:45 +0000 (18:45 +0000)]
Fix PR12942: Allow two CUs to be generated from the same source file.

Thanks Eric for the review.

llvm-svn: 169142

11 years ago[asan] two more bits for __sparc__
Kostya Serebryany [Mon, 3 Dec 2012 18:39:21 +0000 (18:39 +0000)]
[asan] two more bits for __sparc__

llvm-svn: 169141

11 years agoFix clang build issues.
Greg Clayton [Mon, 3 Dec 2012 18:29:55 +0000 (18:29 +0000)]
Fix clang build issues.

llvm-svn: 169140

11 years agolibclangFormat is not libclangTooling, but it depends on it.
Benjamin Kramer [Mon, 3 Dec 2012 18:28:52 +0000 (18:28 +0000)]
libclangFormat is not libclangTooling, but it depends on it.

llvm-svn: 169139

11 years agoFix PR14474: don't emit debug info for interface types in -gline-tables-only mode.
Alexey Samsonov [Mon, 3 Dec 2012 18:28:12 +0000 (18:28 +0000)]
Fix PR14474: don't emit debug info for interface types in -gline-tables-only mode.

llvm-svn: 169138

11 years agoInitial version of formatting library.
Daniel Jasper [Mon, 3 Dec 2012 18:12:45 +0000 (18:12 +0000)]
Initial version of formatting library.

This formatting library will be used by a stand-alone clang-format tool
and can also be used when writing other refactorings.

Manuel's original design document:
https://docs.google.com/a/google.com/document/d/1gpckL2U_6QuU9YW2L1ABsc4Fcogn5UngKk7fE5dDOoA/edit

The library can already successfully format itself.

Review: http://llvm-reviews.chandlerc.com/D80
llvm-svn: 169137

11 years ago<rdar://problem/12742973>
Greg Clayton [Mon, 3 Dec 2012 17:50:07 +0000 (17:50 +0000)]
<rdar://problem/12742973>

Forwarding a fix for a crasher in the demangler.

llvm-svn: 169136

11 years agoTeach the jump threading optimization to stop scanning the basic block when calculati...
Nadav Rotem [Mon, 3 Dec 2012 17:34:44 +0000 (17:34 +0000)]
Teach the jump threading optimization to stop scanning the basic block when calculating the cost after passing the threshold.

llvm-svn: 169135

11 years agoRevert r169039, "Aggregate pass execution time report by pass ID instead of pass...
Jakob Stoklund Olesen [Mon, 3 Dec 2012 17:31:11 +0000 (17:31 +0000)]
Revert r169039, "Aggregate pass execution time report by pass ID instead of pass instance."

llvm-svn: 169134

11 years agoSort the #include lines for the include/... tree with the script.
Chandler Carruth [Mon, 3 Dec 2012 17:02:12 +0000 (17:02 +0000)]
Sort the #include lines for the include/... tree with the script.

AKA: Recompile *ALL* the source code!

This one went much better. No manual edits here. I spot-checked for
silliness and grep-checked for really broken edits and everything seemed
good. It all still compiles. Yell if you see something that looks goofy.

llvm-svn: 169133

11 years agoTeach the include sorter to not choke on include guards. ;]
Chandler Carruth [Mon, 3 Dec 2012 17:01:46 +0000 (17:01 +0000)]
Teach the include sorter to not choke on include guards. ;]

Kind of important when prepping the include/... tree version of the sort
changes.

llvm-svn: 169132

11 years agoUse the new script to sort the includes of every file under lib.
Chandler Carruth [Mon, 3 Dec 2012 16:50:05 +0000 (16:50 +0000)]
Use the new script to sort the includes of every file under lib.

Sooooo many of these had incorrect or strange main module includes.
I have manually inspected all of these, and fixed the main module
include to be the nearest plausible thing I could find. If you own or
care about any of these source files, I encourage you to take some time
and check that these edits were sensible. I can't have broken anything
(I strictly added headers, and reordered them, never removed), but they
may not be the headers you'd really like to identify as containing the
API being implemented.

Many forward declarations and missing includes were added to a header
files to allow them to parse cleanly when included first. The main
module rule does in fact have its merits. =]

llvm-svn: 169131

11 years agoclarify that this isn't lld.
Chris Lattner [Mon, 3 Dec 2012 16:08:32 +0000 (16:08 +0000)]
clarify that this isn't lld.

llvm-svn: 169130

11 years agoMake hasDeclaration work for enums.
Daniel Jasper [Mon, 3 Dec 2012 15:43:25 +0000 (15:43 +0000)]
Make hasDeclaration work for enums.

llvm-svn: 169129

11 years ago[tsan] add CompactSizeClassMap as an alternative (more compact) size class map. Not...
Kostya Serebryany [Mon, 3 Dec 2012 15:00:33 +0000 (15:00 +0000)]
[tsan] add CompactSizeClassMap as an alternative (more compact) size class map. Not used yet.

llvm-svn: 169128

11 years agoUse isl 0.11
Tobias Grosser [Mon, 3 Dec 2012 14:44:14 +0000 (14:44 +0000)]
Use isl 0.11

We now switch to the newly released isl 0.11. This adds a couple of bug fixes
on top of the recent update.

llvm-svn: 169127

11 years agoTest commit: reformat comment.
Edwin Vane [Mon, 3 Dec 2012 14:32:13 +0000 (14:32 +0000)]
Test commit: reformat comment.

llvm-svn: 169126

11 years agoAdd a completely hack-ish tool to sort includes according to the coding
Chandler Carruth [Mon, 3 Dec 2012 14:23:44 +0000 (14:23 +0000)]
Add a completely hack-ish tool to sort includes according to the coding
standards.

I am a terrible Python programmer. Patches more the welcome. Please tell
me how this should look if it should look differently. It's just a tiny
little script so it didn't make sense to go through pre-commit review,
especially as someone who actually knows python may want to just rip it
apart and do it The Right Way.

I will be preparing a commit shortly that uses this script to
canonicalize *all* of the #include lines in LLVM. Really, all of them.

llvm-svn: 169125

11 years agoAdd -fsanitize=memory.
Evgeniy Stepanov [Mon, 3 Dec 2012 13:20:43 +0000 (13:20 +0000)]
Add -fsanitize=memory.

llvm-svn: 169124

11 years ago[tsan] remove unused InternalAllocBlock as part of larger refactoring
Kostya Serebryany [Mon, 3 Dec 2012 11:57:01 +0000 (11:57 +0000)]
[tsan] remove unused InternalAllocBlock as part of larger refactoring

llvm-svn: 169123

11 years agotsan: describe global vars (module+offset for now)
Dmitry Vyukov [Mon, 3 Dec 2012 11:45:34 +0000 (11:45 +0000)]
tsan: describe global vars (module+offset for now)

llvm-svn: 169122

11 years ago[asan] EXPECT_EQ => ASSERT_EQ around pthread_create/pthread_join calls
Kostya Serebryany [Mon, 3 Dec 2012 11:37:03 +0000 (11:37 +0000)]
[asan] EXPECT_EQ => ASSERT_EQ around pthread_create/pthread_join calls

llvm-svn: 169121

11 years agoRemove some buggy and apparantly unnecessary code from SROA.
Chandler Carruth [Mon, 3 Dec 2012 10:59:55 +0000 (10:59 +0000)]
Remove some buggy and apparantly unnecessary code from SROA.

The partitioning logic attempted to handle uses of an alloca with an
offset starting before the alloca so long as the use had some overlap
with the alloca itself. However, there was a bug where we tested
'(uint64_t)Offset >= AllocSize' without first checking whether 'Offset'
was positive. As a consequence, essentially every negative offset (that
is, starting *before* the alloca does) would be thrown out, even if it
was overlapping. The subsequent code to throw out negative offsets which
were actually non-overlapping was essentially dead. The code to *handle*
overlapping negative offsets was actually dead!

I've just removed all of this, and taught SROA to discard any uses which
start prior to the alloca from the beginning. It has the lovely property
of simplifying the code. =] All the tests still pass, and in fact no new
tests are needed as this is already covered by our testsuite. Fixing the
code so that negative offsets work the way the comments indicate they
were supposed to work causes regressions. That's how I found this.

Anyways, this is all progress in the correct direction -- tightening up
SROA to be maximally aggressive. Some day, I really hope to turn
out-of-bounds accesses to an alloca into 'unreachable'.

llvm-svn: 169120

11 years agofix stats for added checks
Nuno Lopes [Mon, 3 Dec 2012 10:15:03 +0000 (10:15 +0000)]
fix stats for added checks

llvm-svn: 169119

11 years ago[asan] in asan tests, check all return values of pthread_create/pthread_join. Also...
Kostya Serebryany [Mon, 3 Dec 2012 09:43:56 +0000 (09:43 +0000)]
[asan] in asan tests, check all return values of pthread_create/pthread_join. Also add the ASAN_AVOID_EXPENSIVE_TESTS macro to guard the test that creates too many threads

llvm-svn: 169118

11 years agoDefine signed const-ext predicates.
Jyotsna Verma [Mon, 3 Dec 2012 06:54:50 +0000 (06:54 +0000)]
Define signed const-ext predicates.

llvm-svn: 169117

11 years agoRemove 'deplibs' keyword, since it's no longer used.
Bill Wendling [Mon, 3 Dec 2012 06:34:06 +0000 (06:34 +0000)]
Remove 'deplibs' keyword, since it's no longer used.

llvm-svn: 169116