Commit Graph

8470 Commits

Author SHA1 Message Date
Nick Lewycky
f80fcd00b3 Improve tail call elimination to handle the switch statement.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86403 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 21:10:15 +00:00
Chris Lattner
f1c104fb32 temporarily remove these tests, as they are breaking in the buildbot,
Eric, please investigate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86399 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 19:13:17 +00:00
Chris Lattner
918871ee01 make instcombine only rewrite a chain of computation
(eliminating some extends) if the new type of the
computation is legal or if both the source and dest
are illegal.  This prevents instcombine from changing big
chains of computation into i64 on 32-bit targets for 
example.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86398 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 19:11:46 +00:00
Chris Lattner
b8391aa969 remove empty files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86392 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 18:03:32 +00:00
Chris Lattner
1d95725d60 Revert r86359, it is breaking the self host on the
llvm-gcc-i386-darwin9 build bot.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86391 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 17:59:32 +00:00
Anton Korobeynikov
6534f83ae8 Add some dummy support for post-incremented loads
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86385 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 17:15:06 +00:00
Anton Korobeynikov
8983da729a Add 8 bit libcalls and make use of them for msp430
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86384 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 17:14:39 +00:00
Anton Korobeynikov
123ed8f099 Initial support for addrmode handling. Tests by Brian Lucas!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86382 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 17:13:35 +00:00
Anton Korobeynikov
e8ea011cc7 It turns out that the testcase in question uncovered subreg-handling bug.
Add assert in asmprinter to catch such cases and xfail the tests.
PR is to be filled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86375 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 15:20:32 +00:00
Eric Christopher
761411c21b Fix a couple of shuffle patterns to use movhlps instead
of movhps as the constraint.  Changes optimizations so
update testcases as appropriate as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86360 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 08:45:53 +00:00
Nick Lewycky
4de9b7f51f Teach dead store elimination that certain intrinsics write to memory just like
a store.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86359 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 08:34:40 +00:00
Chris Lattner
5729d38c81 reapply 86289, 86278, 86270, 86267, 86266 & 86264 plus a fix
(making pred factoring only happen if threading is guaranteed
to be successful).

This now survives an X86-64 bootstrap of llvm-gcc.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86355 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 08:05:03 +00:00
Chris Lattner
e880efe446 Fix PR5421 by APInt'izing switch lowering.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86354 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 07:50:34 +00:00
Nick Lewycky
cb19438f63 Oops, FunctionContainsEscapingAllocas is really used to mean two different
things. Back out part of r86349 for a moment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86353 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 07:42:38 +00:00
Nick Lewycky
0cade26132 Dust off tail recursion elimination. Fix a fixme by applying CaptureTracking
and add a .ll to demo the new capability.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86349 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 07:10:01 +00:00
Chris Lattner
e503871315 merge cmp1 into cmp0 and filecheckize.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86345 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 06:19:20 +00:00
Evan Cheng
d457e6e9a5 Refactor code. Fix a potential missing check. Teach isIdentical() about tLDRpci_pic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86330 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 04:04:34 +00:00
Evan Cheng
78e5c1140a - Add TargetInstrInfo::isIdentical(). It's similar to MachineInstr::isIdentical
except it doesn't care if the definitions' virtual registers differ. This is
  used by machine LICM and other MI passes to perform CSE.
- Teach Thumb2InstrInfo::isIdentical() to check two t2LDRpci_pic are identical.
  Since pc relative constantpool entries are always different, this requires it
  it check if the values can actually the same.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86328 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 03:52:02 +00:00
Devang Patel
12d53dba36 Revert following patches to fix llvmgcc bootstrap.
86289, 86278, 86270, 86267, 86266 & 86264
Chris, please take a look.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86321 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 01:32:59 +00:00
Victor Hernandez
9d0b704e3e Re-commit r86077 now that r86290 fixes the 179.art and 175.vpr ARM regressions.
Here is the original commit message:

This commit updates malloc optimizations to operate on malloc calls that have constant int size arguments.

Update CreateMalloc so that its callers specify the size to allocate:
MallocInst-autoupgrade users use non-TargetData-computed allocation sizes.
Optimization uses use TargetData to compute the allocation size.

Now that malloc calls can have constant sizes, update isArrayMallocHelper() to use TargetData to determine the size of the malloced type and the size of malloced arrays.
Extend getMallocType() to support malloc calls that have non-bitcast uses.

Update OptimizeGlobalAddressOfMalloc() to optimize malloc calls that have non-bitcast uses.  The bitcast use of a malloc call has to be treated specially here because the uses of the bitcast need to be replaced and the bitcast needs to be erased (just like the malloc call) for OptimizeGlobalAddressOfMalloc() to work correctly.

Update PerformHeapAllocSRoA() to optimize malloc calls that have non-bitcast uses.  The bitcast use of the malloc is not handled specially here because ReplaceUsesOfMallocWithGlobal replaces through the bitcast use.

Update OptimizeOnceStoredGlobal() to not care about the malloc calls' bitcast use.

Update all globalopt malloc tests to not rely on autoupgraded-MallocInsts, but instead use explicit malloc calls with correct allocation sizes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86311 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 00:16:28 +00:00
Evan Cheng
b9803a8fa6 - Add pseudo instructions tLDRpci_pic and t2LDRpci_pic which does a pc-relative
load of a GV from constantpool and then add pc. It allows the code sequence to
  be rematerializable so it would be hoisted by machine licm.
- Add a late pass to break these pseudo instructions into a number of real
  instructions. Also move the code in Thumb2 IT pass that breaks up t2MOVi32imm
  to this pass. This is done before post regalloc scheduling to allow the
  scheduler to proper schedule these instructions. It also allow them to be
  if-converted and shrunk by later passes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86304 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 23:52:48 +00:00
Anton Korobeynikov
fc2cba8362 Honour subreg machine operands during asmprinting
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86303 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 23:45:15 +00:00
Bob Wilson
54c78ef2fe Print VMOV (immediate) operands as hexadecimal values. Apple's assembler
will not accept negative values for these.  LLVM's default operand printing
sign extends values, so that valid unsigned values appear as negative
immediates.  Print all VMOV immediate operands as hex values to resolve this.
Radar 7372576.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86301 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 23:33:28 +00:00
Bob Wilson
d51722a7e3 Fix a broken test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86298 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 23:06:42 +00:00
Evan Cheng
e7e0d62efd Remove ARMPCLabelIndex from ARMISelLowering. Use ARMFunctionInfo::createConstPoolEntryUId() instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86294 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 22:24:13 +00:00
Gabor Greif
29d727b0c8 fix typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86281 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 20:10:46 +00:00
Chris Lattner
82114b98c9 Fix a problem discovered on self host.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86278 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 19:21:48 +00:00
Devang Patel
5ebfa2d181 Tolerate invalid derived type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86269 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 18:24:05 +00:00
Chris Lattner
785672534d Extend jump threading to support much more general threading
predicates.  This allows us to jump thread things like:

_ZN12StringSwitchI5ColorE4CaseILj7EEERS1_RAT__KcRKS0_.exit119:
  %tmp1.i24166 = phi i8 [ 1, %bb5.i117 ], [ %tmp1.i24165, %_Z....exit ], [ %tmp1.i24165, %bb4.i114 ] 
  %toBoolnot.i87 = icmp eq i8 %tmp1.i24166, 0     ; <i1> [#uses=1]
  %tmp4.i90 = icmp eq i32 %tmp2.i, 6              ; <i1> [#uses=1]
  %or.cond173 = and i1 %toBoolnot.i87, %tmp4.i90  ; <i1> [#uses=1]
  br i1 %or.cond173, label %bb4.i96, label %_ZN12...

Where it is "obvious" that when coming from %bb5.i117 that the 'and' is always 
false.  This triggers a surprisingly high number of times in the testsuite, 
and gets us closer to generating good code for doug's strswitch testcase.

This also make a bunch of other code in jump threading redundant, I'll rip
out in the next patch.  This survived an enable-checking llvm-gcc bootstrap.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86264 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 18:15:14 +00:00
Devang Patel
84c73e9b82 Do not bother to emit debug info for nameless global variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86259 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 17:58:12 +00:00
Victor Hernandez
df98761d08 Revert r86077 because it caused crashes in 179.art and 175.vpr on ARM
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86213 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 01:33:24 +00:00
Devang Patel
465c3bed16 Do not try to emit debug info entry for dead global variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86212 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 01:30:04 +00:00
Eric Christopher
ef1fad533e Fix PR5315, original patch by Nicolas Capens!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86203 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 00:11:57 +00:00
Dan Gohman
3f131328ff Update these tests for the new label names.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86192 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 23:31:40 +00:00
Dan Gohman
f4e82d1f2e The introduction of indirectbr meant the introduction of
unsplittable critical edges, which means the introduction of
loops which cannot be transformed to LoopSimplify form. Fix
LoopSimplify to avoid transforming such loops into invalid
code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86176 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 21:14:46 +00:00
Benjamin Kramer
992a637297 Teach SimplifyLibCalls to fold memcmp calls with constant arguments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86141 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 17:44:22 +00:00
Chris Lattner
e4bddf1837 merge a few crash tests into crash.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86119 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 05:57:34 +00:00
Bob Wilson
5a225cc85a Add -mtriple to llc commands, attempting to fix buildbot failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86086 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 00:51:31 +00:00
Bob Wilson
8a008cc49d Attempt again to fix buildbot failures: make expected output less specific
and compile with -mtriple to specify *-apple-darwin targets.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86081 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 00:30:35 +00:00
Victor Hernandez
24f934d055 Update CreateMalloc so that its callers specify the size to allocate:
MallocInst-autoupgrade users use non-TargetData-computed allocation sizes.
Optimization uses use TargetData to compute the allocation size.

Now that malloc calls can have constant sizes, update isArrayMallocHelper() to use TargetData to determine the size of the malloced type and the size of malloced arrays.
Extend getMallocType() to support malloc calls that have non-bitcast uses.

Update OptimizeGlobalAddressOfMalloc() to optimize malloc calls that have non-bitcast uses.  The bitcast use of a malloc call has to be treated specially here because the uses of the bitcast need to be replaced and the bitcast needs to be erased (just like the malloc call) for OptimizeGlobalAddressOfMalloc() to work correctly.

Update PerformHeapAllocSRoA() to optimize malloc calls that have non-bitcast uses.  The bitcast use of the malloc is not handled specially here because ReplaceUsesOfMallocWithGlobal replaces through the bitcast use.

Update OptimizeOnceStoredGlobal() to not care about the malloc calls' bitcast use.

Update all globalopt malloc tests to not rely on autoupgraded-MallocInsts, but instead use explicit malloc calls with correct allocation sizes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86077 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 00:03:03 +00:00
Chris Lattner
40dd12e708 improve DSE when TargetData is not around, based on work by
Hans Wennborg!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86067 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 23:20:12 +00:00
Bob Wilson
3d90dbee69 Add PowerPC codegen for indirect branches.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86050 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 21:31:18 +00:00
Bob Wilson
1709dd73d6 Fix broken test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86045 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 20:04:11 +00:00
Bob Wilson
0d48d6106e Add test for ARM indirectbr codegen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86042 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 19:25:34 +00:00
Evan Cheng
50608bac2f RangeIsDefinedByCopyFromReg() should check for subreg_to_reg, insert_subreg,
and extract_subreg as a "copy" that defines a valno.
Also fixes a typo. These two issues prevent a simple subreg coalescing from
happening before.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86022 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 08:33:14 +00:00
Chris Lattner
092543ca71 move two functions up higher in the file. Delete a useless argument
to EmitGEPOffset.  

Implement some new transforms for optimizing 
subtracts of two pointer to ints into the same vector.  This happens
for C++ iterator idioms for example, stringmap takes a const char*
that points to the start and end of a string.  Once inlined, we want
the pointer difference to turn back into a length.

This is rdar://7362831.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86021 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 08:05:20 +00:00
Chris Lattner
6a4ab1e426 filecheckize this test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86020 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 07:57:05 +00:00
Evan Cheng
ad95ff9fab Fix test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85986 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 00:42:33 +00:00
Chris Lattner
fc36a562ae reimplement multiple return value handling in IPSCCP, making it
more aggressive an correct.  This survives building llvm in 64-bit
mode with optimizations and the built llvm passes make check.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85973 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03 23:40:48 +00:00
Evan Cheng
b23b2015eb fconsts / fconstd immediate should be proceeded with #.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85952 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03 21:59:33 +00:00