oota-llvm.git
12 years agoAdd an option for darwin gdb compatibility.
Eric Christopher [Thu, 23 Aug 2012 07:10:46 +0000 (07:10 +0000)]
Add an option for darwin gdb compatibility.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162432 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMake the setInst method take its MCInst parameter by reference, a la Jim's
Lang Hames [Thu, 23 Aug 2012 07:00:48 +0000 (07:00 +0000)]
Make the setInst method take its MCInst parameter by reference, a la Jim's
change in r162404.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162431 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUse a switch statement instead of a bunch of if-else checks and pull out the common...
Craig Topper [Thu, 23 Aug 2012 04:57:36 +0000 (04:57 +0000)]
Use a switch statement instead of a bunch of if-else checks and pull out the common function call.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162428 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove unused private field to silence build warning.
Craig Topper [Thu, 23 Aug 2012 04:45:31 +0000 (04:45 +0000)]
Remove unused private field to silence build warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162426 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago80-col.
Eric Christopher [Thu, 23 Aug 2012 00:52:51 +0000 (00:52 +0000)]
80-col.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162422 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTidy.
Eric Christopher [Thu, 23 Aug 2012 00:52:49 +0000 (00:52 +0000)]
Tidy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162421 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSimplify the computeOperandLatency API.
Andrew Trick [Thu, 23 Aug 2012 00:39:43 +0000 (00:39 +0000)]
Simplify the computeOperandLatency API.

The logic for recomputing latency based on a ScheduleDAG edge was
shady. This bypasses the problem by requiring the client to provide
operand indices. This ensures consistent use of the machine model's
API.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162420 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMake function loadImmediate a member of MipsSEInstrInfo and change it to return
Akira Hatanaka [Thu, 23 Aug 2012 00:21:05 +0000 (00:21 +0000)]
Make function loadImmediate a member of MipsSEInstrInfo and change it to return
the temporary register that was used to load the immediate. Currently, it always
returns register $at, but this will change if, in the future, we decide to use
another register.

No changes in functionality.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162417 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a member of type Mips16InstrInfo/MipsSEInstrInfo to class
Akira Hatanaka [Wed, 22 Aug 2012 23:58:53 +0000 (23:58 +0000)]
Add a member of type Mips16InstrInfo/MipsSEInstrInfo to class
Mips16RegisterInfo/MipsSERegisterInfo.

No changes in functionality.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162413 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix an assortment of doxygen comment mistakes found by -Wdocumentation.
Ted Kremenek [Wed, 22 Aug 2012 23:49:16 +0000 (23:49 +0000)]
Fix an assortment of doxygen comment mistakes found by -Wdocumentation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162411 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPrint out the location of expanded multiclass defs in TableGen errors.
Jakob Stoklund Olesen [Wed, 22 Aug 2012 23:33:58 +0000 (23:33 +0000)]
Print out the location of expanded multiclass defs in TableGen errors.

When reporting an error for a defm, we would previously only report the
location of the outer defm, which is not always where the error is.

Now we also print the location of the expanded multiclass defs:

lib/Target/X86/X86InstrSSE.td:2902:12: error: foo
  defm ADD : basic_sse12_fp_binop_s<0x58, "add", fadd, SSE_ALU_ITINS_S>,
             ^
lib/Target/X86/X86InstrSSE.td:2801:11: note: instantiated from multiclass
  defm PD : sse12_fp_packed<opc, !strconcat(OpcodeStr, "pd"), OpNode, VR128,
            ^
lib/Target/X86/X86InstrSSE.td:194:5: note: instantiated from multiclass
    def rm : PI<opc, MRMSrcMem, (outs RC:$dst), (ins RC:$src1, x86memop:$src2),
        ^

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162409 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMCInstFragment constructor should take by-reference MCInst.
Jim Grosbach [Wed, 22 Aug 2012 22:19:40 +0000 (22:19 +0000)]
MCInstFragment constructor should take by-reference MCInst.

The MCInst is immediately passed to the copy-constructor for local
storage, so there's no need for the parameter itself to be by-value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162404 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agodarwin/cross-build: Unset SDKROOT when building BuildTools.
Daniel Dunbar [Wed, 22 Aug 2012 22:01:01 +0000 (22:01 +0000)]
darwin/cross-build: Unset SDKROOT when building BuildTools.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162402 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSimplifyLibCalls: Give all safely-shrinkable libcalls the same treatment.
Benjamin Kramer [Wed, 22 Aug 2012 19:39:15 +0000 (19:39 +0000)]
SimplifyLibCalls: Give all safely-shrinkable libcalls the same treatment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162383 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Avoid a false positive assertion
Chad Rosier [Wed, 22 Aug 2012 19:14:29 +0000 (19:14 +0000)]
[ms-inline asm] Avoid a false positive assertion

Assertion failed: (Start.isValid() == End.isValid() && "Start and end should
either both be valid or both be invalid!")

when parsing inline asm.  SMLoc assumes that the first char * in the source is
invalid.  However, when parsing an inline asm the mnemonic is at this location.
I don't want to change SMLoc, so use a trivial workaround.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162381 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWhitespace.
Chad Rosier [Wed, 22 Aug 2012 17:34:11 +0000 (17:34 +0000)]
Whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162370 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd test case for r162368.
Chad Rosier [Wed, 22 Aug 2012 17:31:04 +0000 (17:31 +0000)]
Add test case for r162368.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162369 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a few float shrinking optimizations to SimplifyLibCalls. Unsafe
Chad Rosier [Wed, 22 Aug 2012 17:22:33 +0000 (17:22 +0000)]
Add a few float shrinking optimizations to SimplifyLibCalls.  Unsafe
optimizations are guarded by the -enable-double-float-shrink LLVM option.
Last bit of PR13574.  Patch by Weiming Zhao <weimingz@codeaurora.org>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162368 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTidy up a few more uses of MF.getFunction()->getName().
David Blaikie [Wed, 22 Aug 2012 17:18:53 +0000 (17:18 +0000)]
Tidy up a few more uses of MF.getFunction()->getName().

Based on CR feedback from r162301 and Craig Topper's refactoring in r162347
here are a few other places that could use the same API (& in one instance drop
a Function.h dependency).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162367 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a new helper function, AddOpt(F1, F1, Opt), as part of PR13574. No
Chad Rosier [Wed, 22 Aug 2012 16:52:57 +0000 (16:52 +0000)]
Add a new helper function, AddOpt(F1, F1, Opt), as part of PR13574.  No
functional change intended.  Patch by Weiming Zhao <weimingz@codeaurora.org>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162363 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoReduce duplicated hash map lookups.
Benjamin Kramer [Wed, 22 Aug 2012 15:37:57 +0000 (15:37 +0000)]
Reduce duplicated hash map lookups.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162362 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRejected 169195. As Duncan commented, bitcasting to proper type is wrong approach...
Stepan Dyatkovskiy [Wed, 22 Aug 2012 09:33:55 +0000 (09:33 +0000)]
Rejected 169195. As Duncan commented, bitcasting to proper type is wrong approach. We need to insert some valid TRANCATE node here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162354 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a getName function to MachineFunction. Use it in places that previously did getFu...
Craig Topper [Wed, 22 Aug 2012 06:07:19 +0000 (06:07 +0000)]
Add a getName function to MachineFunction. Use it in places that previously did getFunction()->getName(). Remove includes of Function.h that are no longer needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162347 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDon't cache the MBB in the class. Its only used by one function. Change a for loop...
Craig Topper [Wed, 22 Aug 2012 05:59:59 +0000 (05:59 +0000)]
Don't cache the MBB in the class. Its only used by one function. Change a for loop over operands to use unsigned instead of int.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162344 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMark a function as static since it doesn't use anything in the class.
Craig Topper [Wed, 22 Aug 2012 05:36:44 +0000 (05:36 +0000)]
Mark a function as static since it doesn't use anything in the class.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162342 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd register Mips::GP to the list of reserved registers if target is bare-metal
Akira Hatanaka [Wed, 22 Aug 2012 03:18:13 +0000 (03:18 +0000)]
Add register Mips::GP to the list of reserved registers if target is bare-metal
to prevent it from being clobbered. mips uses $gp to access small data section.

This bug was originally reported by Carl Norum.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162340 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd option disable-mips-delay-filler. Turn on mips' delay slot filler by
Akira Hatanaka [Wed, 22 Aug 2012 02:51:28 +0000 (02:51 +0000)]
Add option disable-mips-delay-filler. Turn on mips' delay slot filler by
default.

Patch by Carl Norum.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162339 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTblGen: Make asm-matcher ConvertToMCInst() table driven.
Jim Grosbach [Wed, 22 Aug 2012 01:06:23 +0000 (01:06 +0000)]
TblGen: Make asm-matcher ConvertToMCInst() table driven.

No change in interface or functionality. Purely under-the-hood
details of the generated function that change.

The X86 assembly parser is reduced in size by over 15% and ARM by
over 10%.

No performance change by my measurements.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162337 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFor mips64 switch statements in subroutines could generate
Jack Carter [Wed, 22 Aug 2012 00:49:30 +0000 (00:49 +0000)]
For mips64 switch statements in subroutines could generate
within the codegen EK_GPRel64BlockAddress. This was not
supported for direct object output and resulted in an assertion.

This change adds support for EK_GPRel64BlockAddress for
direct object.

One fallout from this is to turn on rela relocations
for mips64 to match gas.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162334 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoInitialize SelectionDAGBuilder's Context in 'init', not in its constructor. The
Richard Smith [Wed, 22 Aug 2012 00:42:39 +0000 (00:42 +0000)]
Initialize SelectionDAGBuilder's Context in 'init', not in its constructor. The
SelectionDAG's 'init' has not been called when the SelectionDAGBuilder is
constructed (in SelectionDAGISel's constructor), so this was previously always
initialized with 0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162333 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoReduce alignment of SmallVector<T> to the required amount, rather than forcing 16...
Richard Smith [Wed, 22 Aug 2012 00:11:07 +0000 (00:11 +0000)]
Reduce alignment of SmallVector<T> to the required amount, rather than forcing 16-byte alignment. This fixes misaligned SmallVector accesses via ExtractValueInst's SmallVector data member.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162331 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a few functions to TargetLibraryInfo as part of PR13574.
Chad Rosier [Tue, 21 Aug 2012 23:28:56 +0000 (23:28 +0000)]
Add a few functions to TargetLibraryInfo as part of PR13574.
Patch by Weiming Zhao <weimingz@codeaurora.org>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162329 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMaximumSpanningTree::EdgeWeightCompare: Make this comparator actually be a
Richard Smith [Tue, 21 Aug 2012 21:03:40 +0000 (21:03 +0000)]
MaximumSpanningTree::EdgeWeightCompare: Make this comparator actually be a
strict weak ordering, and don't pass possibly-null pointers to dyn_cast.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162314 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix misaligned access in MachO object file reader: despite containing an
Richard Smith [Tue, 21 Aug 2012 20:52:03 +0000 (20:52 +0000)]
Fix misaligned access in MachO object file reader: despite containing an
int64_t, Symbol64TableEntry is actually only stored with 4-byte alignment
within the file.

The usage of #pragma pack here is copied from the corresponding code in
Support/Endian.h, so shouldn't introduce any new portability problems.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162312 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix unaligned memory accesses when performing relocations in X86 JIT. There's
Richard Smith [Tue, 21 Aug 2012 20:48:36 +0000 (20:48 +0000)]
Fix unaligned memory accesses when performing relocations in X86 JIT. There's
no cost to using memcpy here: the fixed code is optimized by LLVM to perfect
machine code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162311 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDon't pass a null pointer to cast<> in its unit tests.
Richard Smith [Tue, 21 Aug 2012 20:39:25 +0000 (20:39 +0000)]
Don't pass a null pointer to cast<> in its unit tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162310 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDon't bind a reference to a dereferenced null pointer (for return value of WeakVH...
Richard Smith [Tue, 21 Aug 2012 20:35:14 +0000 (20:35 +0000)]
Don't bind a reference to a dereferenced null pointer (for return value of WeakVH::operator*).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162309 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Do not report a Parser error when matching inline assembly.
Chad Rosier [Tue, 21 Aug 2012 19:36:59 +0000 (19:36 +0000)]
[ms-inline asm] Do not report a Parser error when matching inline assembly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162306 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoIgnore the documentation-suggested location for compile_commands.json
David Blaikie [Tue, 21 Aug 2012 19:23:30 +0000 (19:23 +0000)]
Ignore the documentation-suggested location for compile_commands.json

According to http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html
it's suggested that compile_commands.json in the root of the LLVM source tree
should be a symlink to the json file produced by your build system of choice.

So here's a patch so it doesn't turn up in git status, etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162305 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoThe presence of the empty file "foo" unfortunately does not improve LLVM in any way.
David Blaikie [Tue, 21 Aug 2012 19:13:12 +0000 (19:13 +0000)]
The presence of the empty file "foo" unfortunately does not improve LLVM in any way.

Thanks to Duncan Sands for catching this random file in code review.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162304 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove unnecessary cast that was also unnecessarily casting away constness.
David Blaikie [Tue, 21 Aug 2012 18:54:23 +0000 (18:54 +0000)]
Remove unnecessary cast that was also unnecessarily casting away constness.

Even looking at the revision history I couldn't quite piece together why this
cast was ever written in the first place, but I assume it was because of some
change in the inheritance, perhaps this function was reimplemented in a
derived type & this caller was meant to get the base version (& it wasn't
virtual)?

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162301 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoProvide a portability macro for __builtin_trap.
David Blaikie [Tue, 21 Aug 2012 18:54:21 +0000 (18:54 +0000)]
Provide a portability macro for __builtin_trap.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162300 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix macros arguments with an underscore, dot or dollar in them. This is based
Rafael Espindola [Tue, 21 Aug 2012 18:29:30 +0000 (18:29 +0000)]
Fix macros arguments with an underscore, dot or dollar in them. This is based
on a patch by Andy/PaX. I added the support for dot and dollar.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162298 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[ms-inline asm] Expose the ErrorInfo from the MatchInstructionImpl. In general,
Chad Rosier [Tue, 21 Aug 2012 18:14:59 +0000 (18:14 +0000)]
[ms-inline asm] Expose the ErrorInfo from the MatchInstructionImpl.  In general,
this is the index of the operand that failed to match.

Note: This may cause a buildbot failure due to an API mismatch in clang.  Should
recover with my next commit to clang.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162295 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFormatting. No functional change.
Chad Rosier [Tue, 21 Aug 2012 17:22:47 +0000 (17:22 +0000)]
Formatting.  No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162292 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMake the wording in of the "expected identifier" error in the .macro directive
Rafael Espindola [Tue, 21 Aug 2012 17:12:05 +0000 (17:12 +0000)]
Make the wording in of the "expected identifier" error in the .macro directive
consistent with the other "expected identifier" errors.
Extracted from the Andy/PaX patch. I added the test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162291 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPacify PVS-Studio by changing the type rather than doing a cast, a tweak
Duncan Sands [Tue, 21 Aug 2012 16:20:37 +0000 (16:20 +0000)]
Pacify PVS-Studio by changing the type rather than doing a cast, a tweak
suggested by David Blaikie.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162286 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd support for the --param ssp-buffer-size= driver option.
Chad Rosier [Tue, 21 Aug 2012 16:15:24 +0000 (16:15 +0000)]
Add support for the --param ssp-buffer-size= driver option.
PR9673

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162284 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUse typedefs. Fix indentation. Extracted from the Andy/PaX patch.
Rafael Espindola [Tue, 21 Aug 2012 16:06:48 +0000 (16:06 +0000)]
Use typedefs. Fix indentation. Extracted from the Andy/PaX patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162283 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove unused variable. Extracted from the Andy/PaX patch.
Rafael Espindola [Tue, 21 Aug 2012 16:01:14 +0000 (16:01 +0000)]
Remove unused variable. Extracted from the Andy/PaX patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162282 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix typo. Extracted from the Andy/PaX patch.
Rafael Espindola [Tue, 21 Aug 2012 15:55:04 +0000 (15:55 +0000)]
Fix typo. Extracted from the Andy/PaX patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162281 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMCJIT: Tidy up the constructor.
Jim Grosbach [Tue, 21 Aug 2012 15:42:49 +0000 (15:42 +0000)]
MCJIT: Tidy up the constructor.

The MCJIT doesn't need or want a TargetJITInfo. That's vestigal from the old
JIT, so just remove it.

rdar://12119347

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162280 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPVS-Studio noticed that EmitVBR64 would perform undefined behaviour if the
Duncan Sands [Tue, 21 Aug 2012 13:47:25 +0000 (13:47 +0000)]
PVS-Studio noticed that EmitVBR64 would perform undefined behaviour if the
number of bits was bigger than 32.  I checked every use of this function
that I could find and it looks like the maximum number of bits is 32, so I've
added an assertion checking this property, and a type cast to (hopefully) stop
PVS-Studio from warning about this in the future.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162277 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd correct set of regression tests for r162094 commit.
Tim Northover [Tue, 21 Aug 2012 12:43:03 +0000 (12:43 +0000)]
Add correct set of regression tests for r162094 commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162276 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPort the global copy optimization from the SROA pass to InstCombine.
Chandler Carruth [Tue, 21 Aug 2012 08:39:44 +0000 (08:39 +0000)]
Port the global copy optimization from the SROA pass to InstCombine.
This optimization is really just replacing allocas wholesale with
globals, there is no scalarization.

The underlying motivation for this patch is to simplify the SROA pass
and focus it on splitting and promoting allocas.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162271 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix up indentation and remove a couple else's after returns.
Craig Topper [Tue, 21 Aug 2012 08:29:51 +0000 (08:29 +0000)]
Fix up indentation and remove a couple else's after returns.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162270 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[asan] add code to detect global initialization fiasco in C/C++. The sub-pass is...
Kostya Serebryany [Tue, 21 Aug 2012 08:24:25 +0000 (08:24 +0000)]
[asan] add code to detect global initialization fiasco in C/C++. The sub-pass is off by default for now. Patch by Reid Watson. Note: this patch changes the interface between LLVM and compiler-rt parts of asan. The corresponding patch to compiler-rt will follow.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162268 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUse uint16_t for tables of opcodes.
Craig Topper [Tue, 21 Aug 2012 08:23:21 +0000 (08:23 +0000)]
Use uint16_t for tables of opcodes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162267 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix up indentation. No functional change.
Craig Topper [Tue, 21 Aug 2012 08:17:07 +0000 (08:17 +0000)]
Fix up indentation. No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162264 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a couple llvm_unreachables. Add a message to several others.
Craig Topper [Tue, 21 Aug 2012 08:16:16 +0000 (08:16 +0000)]
Add a couple llvm_unreachables. Add a message to several others.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162263 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoReplace a break with llvm_unreachable in the default case of a nested switch. Condens...
Craig Topper [Tue, 21 Aug 2012 07:32:16 +0000 (07:32 +0000)]
Replace a break with llvm_unreachable in the default case of a nested switch. Condense code a bit. No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162261 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoCleanup the scalar FMA3 definitions. Add patterns to fold loads with scalar forms.
Craig Topper [Tue, 21 Aug 2012 07:11:11 +0000 (07:11 +0000)]
Cleanup the scalar FMA3 definitions. Add patterns to fold loads with scalar forms.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162260 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMerge FMA3 instructions with and without patterns into single classes using null_frag.
Craig Topper [Tue, 21 Aug 2012 05:56:45 +0000 (05:56 +0000)]
Merge FMA3 instructions with and without patterns into single classes using null_frag.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162257 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agorevise debug output to avoid dangling pointer
Michael Liao [Tue, 21 Aug 2012 05:55:22 +0000 (05:55 +0000)]
revise debug output to avoid dangling pointer

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162256 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a missing def flag.
Jakob Stoklund Olesen [Tue, 21 Aug 2012 00:34:53 +0000 (00:34 +0000)]
Add a missing def flag.

*** Bad machine code: Explicit definition marked as use ***
- function:    test_cos
- basic block: BB#0 L.entry (0x7ff2a2024fd0)
- instruction: VSETLNi32 %D11, %D11<undef>, %R0, 0, pred:14, pred:%noreg, %Q5<imp-use,kill>, %Q5<imp-def>
- operand 0:   %D11

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162247 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix a quadratic algorithm in MachineBranchProbabilityInfo.
Jakob Stoklund Olesen [Mon, 20 Aug 2012 22:01:38 +0000 (22:01 +0000)]
Fix a quadratic algorithm in MachineBranchProbabilityInfo.

The getSumForBlock function was quadratic in the number of successors
because getSuccWeight would perform a linear search for an already known
iterator.

This patch was originally committed as r161460, but reverted again
because of assertion failures. Now that duplicate Machine CFG edges have
been eliminated, this works properly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162233 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDon't add CFG edges for redundant conditional branches.
Jakob Stoklund Olesen [Mon, 20 Aug 2012 21:39:52 +0000 (21:39 +0000)]
Don't add CFG edges for redundant conditional branches.

IR that hasn't been through SimplifyCFG can look like this:

  br i1 %b, label %r, label %r

Make sure we don't create duplicate Machine CFG edges in this case.

Fix the machine code verifier to accept conditional branches with a
single CFG edge.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162230 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoClarify that duplicate edges are not allowed in the Machine CFG.
Jakob Stoklund Olesen [Mon, 20 Aug 2012 21:05:58 +0000 (21:05 +0000)]
Clarify that duplicate edges are not allowed in the Machine CFG.

LLVM IR has labeled duplicate CFG edges, but since Machine CFG edges
don't have labels, it doesn't make sense to allow duplicates. There is
no way of telling what the edges mean.

Duplicate CFG edges cause confusion when dealing with edge weights. It
seems that code producing duplicate CFG edges usually does the wrong
thing with edge weights.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162227 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a verification pass after ExpandISelPseudos.
Jakob Stoklund Olesen [Mon, 20 Aug 2012 20:52:08 +0000 (20:52 +0000)]
Add a verification pass after ExpandISelPseudos.

This pass often has weird CFG hacks and hand-written MI building code
that can go wrong in many ways.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162224 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd CFG checks to MachineVerifier.
Jakob Stoklund Olesen [Mon, 20 Aug 2012 20:52:06 +0000 (20:52 +0000)]
Add CFG checks to MachineVerifier.

Verify that the predecessor and successor lists are consistent and free
of duplicates.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162223 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUse a SmallPtrSet to dedup successors in EmitSjLjDispatchBlock.
Jakob Stoklund Olesen [Mon, 20 Aug 2012 20:52:03 +0000 (20:52 +0000)]
Use a SmallPtrSet to dedup successors in EmitSjLjDispatchBlock.

The test case ARM/2011-05-04-MultipleLandingPadSuccs.ll was creating
duplicate successor list entries.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162222 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoenable cross compilation with cmake
Sebastian Pop [Mon, 20 Aug 2012 19:56:52 +0000 (19:56 +0000)]
enable cross compilation with cmake

This patch allows us to use cmake to specify a cross compiler: target different
than host. In particular, it moves LLVM_DEFAULT_TARGET_TRIPLE and TARGET_TRIPLE
variables from cmake/config-ix.cmake to the toplevel CMakeLists.txt to make them
available at configure time.

Here is the command line that I have used to test my patches to create a Hexagon
cross compiler hosted on x86:

$ cmake -G Ninja -D LLVM_TARGETS_TO_BUILD:STRING=Hexagon -D TARGET_TRIPLE:STRING=hexagon-unknown-linux-gnu -D LLVM_DEFAULT_TARGET_TRIPLE:STRING=hexagon-unknown-linux-gnu -D LLVM_TARGET_ARCH:STRING=hexagon-unknown-linux-gnu ..
$ ninja check

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162219 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoenable Hexagon target from cmake
Sebastian Pop [Mon, 20 Aug 2012 19:56:49 +0000 (19:56 +0000)]
enable Hexagon target from cmake

The patch adds a missing case for the Hexagon target in cmake/config-ix.cmake.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162218 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agofix HexagonSubtarget parsing of -mv flag
Sebastian Pop [Mon, 20 Aug 2012 19:56:47 +0000 (19:56 +0000)]
fix HexagonSubtarget parsing of -mv flag

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162217 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agofix a case where all operands of BUILD_VECTOR are undefined
Michael Liao [Mon, 20 Aug 2012 17:59:18 +0000 (17:59 +0000)]
fix a case where all operands of BUILD_VECTOR are undefined

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162214 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix coding style violations in 162135 and 162136.
Akira Hatanaka [Mon, 20 Aug 2012 17:53:24 +0000 (17:53 +0000)]
Fix coding style violations in 162135 and 162136.

Patch by Petar Jovanovic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162213 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDataExtractor: Fix integer truncation issues in LEB128 extraction.
Benjamin Kramer [Mon, 20 Aug 2012 10:52:11 +0000 (10:52 +0000)]
DataExtractor: Fix integer truncation issues in LEB128 extraction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162201 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoForget to add testcase for r162195. Sorry.
Stepan Dyatkovskiy [Mon, 20 Aug 2012 08:03:18 +0000 (08:03 +0000)]
Forget to add testcase for r162195. Sorry.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162196 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFixed DAGCombiner bug (found and localized by James Malloy):
Stepan Dyatkovskiy [Mon, 20 Aug 2012 07:57:06 +0000 (07:57 +0000)]
Fixed DAGCombiner bug (found and localized by James Malloy):
The DAGCombiner tries to optimise a BUILD_VECTOR by checking if it
consists purely of get_vector_elts from one or two source vectors. If
so, it either makes a concat_vectors node or a shufflevector node.

However, it doesn't check the element type width of the underlying
vector, so if you have this sequence:

Node0: v4i16 = ...
Node1: i32 = extract_vector_elt Node0
Node2: i32 = extract_vector_elt Node0
Node3: v16i8 = BUILD_VECTOR Node1, Node2, ...

It will attempt to:

Node0:    v4i16 = ...
NewNode1: v16i8 = concat_vectors Node0, ...

Where this is actually invalid because the element width is completely
different. This causes an assertion failure on DAG legalization stage.

Fix:
If output item type of BUILD_VECTOR differs from input item type.
Make concat_vectors based on input element type and then bitcast it to the output vector type. So the case described above will transformed to:
Node0:    v4i16 = ...
NewNode1: v8i16 = concat_vectors Node0, ...
NewNode2: v16i8 = bitcast NewNode1

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162195 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove FMA3 intrinsic instructions in favor of patterns.
Craig Topper [Mon, 20 Aug 2012 06:21:25 +0000 (06:21 +0000)]
Remove FMA3 intrinsic instructions in favor of patterns.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162194 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUse correct intrinsic for 256-bit VFMSUBADDPS.
Craig Topper [Mon, 20 Aug 2012 06:03:04 +0000 (06:03 +0000)]
Use correct intrinsic for 256-bit VFMSUBADDPS.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162193 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove trailing white space and tab characters. No functional change.
Craig Topper [Sun, 19 Aug 2012 23:37:46 +0000 (23:37 +0000)]
Remove trailing white space and tab characters. No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162192 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWhen unsafe math is used, we can use commutative FMAX and FMIN. In some cases
Nadav Rotem [Sun, 19 Aug 2012 13:06:16 +0000 (13:06 +0000)]
When unsafe math is used, we can use commutative FMAX and FMIN. In some cases
this allows for better code generation.

Added a new DAGCombine transformation to convert FMAX and FMIN to FMANC and
FMINC, which are commutative.

For example:

  movaps  %xmm0, %xmm1
  movsd LC(%rip), %xmm0
  minsd %xmm1, %xmm0

becomes:

  minsd LC(%rip), %xmm0

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162187 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFabs folding is implemented.
Benjamin Kramer [Sun, 19 Aug 2012 09:51:44 +0000 (09:51 +0000)]
Fabs folding is implemented.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162186 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoInstCombine: Fix a crasher when encountering a function pointer.
Benjamin Kramer [Sat, 18 Aug 2012 22:04:34 +0000 (22:04 +0000)]
InstCombine: Fix a crasher when encountering a function pointer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162180 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove the CAND/COR/CXOR custom ISD nodes and their select code.
Jakob Stoklund Olesen [Sat, 18 Aug 2012 21:49:50 +0000 (21:49 +0000)]
Remove the CAND/COR/CXOR custom ISD nodes and their select code.

These nodes are no longer needed because the peephole pass can fold
CMOV+AND into ANDCC etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162179 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove virtual from many methods. These methods replace methods in the base class...
Craig Topper [Sat, 18 Aug 2012 21:38:45 +0000 (21:38 +0000)]
Remove virtual from many methods. These methods replace methods in the base class, but the base class methods aren't virtual so it just increased call overhead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162178 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAlso combine zext/sext into selects for ARM.
Jakob Stoklund Olesen [Sat, 18 Aug 2012 21:25:22 +0000 (21:25 +0000)]
Also combine zext/sext into selects for ARM.

This turns common i1 patterns into predicated instructions:

  (add (zext cc), x) -> (select cc (add x, 1), x)
  (add (sext cc), x) -> (select cc (add x, -1), x)

For a function like:

  unsigned f(unsigned s, int x) {
    return s + (x>0);
  }

We now produce:

  cmp r1, #0
  it  gt
  addgt.w r0, r0, #1

Instead of:

  movs  r2, #0
  cmp r1, #0
  it  gt
  movgt r2, #1
  add r0, r2

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162177 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAlso pass logical ops to combineSelectAndUse.
Jakob Stoklund Olesen [Sat, 18 Aug 2012 21:25:16 +0000 (21:25 +0000)]
Also pass logical ops to combineSelectAndUse.

Add these transformations to the existing add/sub ones:

  (and (select cc, -1, c), x) -> (select cc, x, (and, x, c))
  (or  (select cc, 0, c), x)  -> (select cc, x, (or, x, c))
  (xor (select cc, 0, c), x)  -> (select cc, x, (xor, x, c))

The selects can then be transformed to a single predicated instruction
by peephole.

This transformation will make it possible to eliminate the ISD::CAND,
COR, and CXOR custom DAG nodes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162176 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove overly conservative hasOneUse check, this always expands into a single IR...
Benjamin Kramer [Sat, 18 Aug 2012 20:24:19 +0000 (20:24 +0000)]
Remove overly conservative hasOneUse check, this always expands into a single IR instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162175 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoInstCombine: Add a couple of fabs identities for comparing with 0.0.
Benjamin Kramer [Sat, 18 Aug 2012 20:06:47 +0000 (20:06 +0000)]
InstCombine: Add a couple of fabs identities for comparing with 0.0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162174 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSimplifyLibcalls: Add fabs and trunc to the list of libcalls that are safe to shrink...
Benjamin Kramer [Sat, 18 Aug 2012 19:27:32 +0000 (19:27 +0000)]
SimplifyLibcalls: Add fabs and trunc to the list of libcalls that are safe to shrink from double to float.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162173 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoReapply r162160 with a fix: Optimize Arith->Trunc->SETCC sequence to allow better...
Nadav Rotem [Sat, 18 Aug 2012 17:53:03 +0000 (17:53 +0000)]
Reapply r162160 with a fix: Optimize Arith->Trunc->SETCC sequence to allow better compare/branch code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162172 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agofp16-to-fp32 conversion instructions are available in Thumb mode as well.
Anton Korobeynikov [Sat, 18 Aug 2012 13:08:43 +0000 (13:08 +0000)]
fp16-to-fp32 conversion instructions are available in Thumb mode as well.
Make sure the generic pattern is used.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162170 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRefactor code a bit to reduce number of calls in the final compiled code. No function...
Craig Topper [Sat, 18 Aug 2012 06:39:34 +0000 (06:39 +0000)]
Refactor code a bit to reduce number of calls in the final compiled code. No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162166 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoReorder initialization list to silence -Wreorder
Craig Topper [Sat, 18 Aug 2012 06:20:54 +0000 (06:20 +0000)]
Reorder initialization list to silence -Wreorder

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162165 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRevert r162160 because it made a few buildbots fail.
Nadav Rotem [Sat, 18 Aug 2012 05:02:36 +0000 (05:02 +0000)]
Revert r162160 because it made a few buildbots fail.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162164 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoThe X86 backend has a number of optimizations for SETCC nodes which use
Nadav Rotem [Sat, 18 Aug 2012 02:43:28 +0000 (02:43 +0000)]
The X86 backend has a number of optimizations for SETCC nodes which use
arithmetic instructions. However, when small data types are used, a truncate
node appears between the SETCC node and the arithmetic operation. This patch
adds support for this pattern.

Before:
  xorl  %esi, %edi
  testb %dil, %dil
  setne %al
  ret

After:
  xorb  %dil, %sil
  setne %al
  ret

rdar://12081007

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162160 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMake atomic load and store of pointers work. Tighten verification of atomic operations
Eli Friedman [Fri, 17 Aug 2012 23:24:29 +0000 (23:24 +0000)]
Make atomic load and store of pointers work.  Tighten verification of atomic operations
so other unexpected operations don't slip through.  Based on patch by Logan Chien.
PR11786/PR13186.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162146 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix undefined behavior (binding a reference to a dereferenced null pointer) if
Richard Smith [Fri, 17 Aug 2012 21:42:44 +0000 (21:42 +0000)]
Fix undefined behavior (binding a reference to a dereferenced null pointer) if
SSAUpdater was created and destroyed without being initialized.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162137 91177308-0d34-0410-b5e6-96231b3b80d8