Commit Graph

4236 Commits

Author SHA1 Message Date
Matthijs Kooijman e91aed6ce1 Remove debug output.
llvm-svn: 52535
2008-06-20 14:03:35 +00:00
Matthijs Kooijman 8d32dee428 Recommit r52459, rewriting of the dead argument elimination pass.
This is a fixed version that no longer uses multimap::equal_range, which
resulted in a pointer invalidation problem.

Also, DAE::InspectedFunctions was not really necessary, so it got removed.

Lastly, this version no longer applies the extra arg hack on functions who did
not have any arguments to start with.

llvm-svn: 52532
2008-06-20 09:36:16 +00:00
Owen Anderson 78fbcafb53 Really disable PRE.
llvm-svn: 52531
2008-06-20 08:59:13 +00:00
Chris Lattner f3ecd2d290 Fix PR2471, which is a bug involving an invalid promotion from a conditional load.
llvm-svn: 52525
2008-06-20 05:12:56 +00:00
Owen Anderson 1b3ea963f7 Change around the data structures used to store availability sets, resulting in a GVN+PRE that is faster that GVN alone was before.
llvm-svn: 52521
2008-06-20 01:15:47 +00:00
Dan Gohman 041f9d03ff Teach SCCP about insertvalue and extractvalue, and about
propagating constants across aggregate return values when
insertvalue and extractvalue are used.

llvm-svn: 52520
2008-06-20 01:15:44 +00:00
Dan Gohman 3b18fd7b02 Teach InlineFunction how to differentiate between multiple-value
return statements and aggregate returns so that it handles both
correctly.

llvm-svn: 52519
2008-06-20 01:03:44 +00:00
Evan Cheng 9598f930f3 Disable PRE for now. It seems to be breaking llvm-gcc bootstrapping.
llvm-svn: 52518
2008-06-20 01:01:07 +00:00
Owen Anderson e780d66657 Add a hidden -disable-pre flag for testing purposes. This should be removed
once benchmarking is completed.

llvm-svn: 52506
2008-06-19 19:57:25 +00:00
Owen Anderson fdf9f168b5 PRE requires that critical edges be split.
llvm-svn: 52505
2008-06-19 19:54:19 +00:00
Bill Wendling cd6fb1d0a8 Remove dead code causing a warning.
llvm-svn: 52502
2008-06-19 18:00:44 +00:00
Dan Gohman d6530872f3 Use the common API for adding instructions to basic blocks instead of
using BasicBlock::getInstList.

llvm-svn: 52500
2008-06-19 17:53:32 +00:00
Owen Anderson ff21db851d Be sure to remove values from the value numbering table after we delete them.
This fixes a failure on povray.

llvm-svn: 52499
2008-06-19 17:53:26 +00:00
Dan Gohman ed2250990a Use Instruction::moveBefore instead of manipulating the instruction list
directly.

llvm-svn: 52498
2008-06-19 17:47:47 +00:00
Dan Gohman 9eea470fcf Avoid using BasicBlock::getInstList directly in a few places.
llvm-svn: 52497
2008-06-19 17:37:25 +00:00
Owen Anderson 45d3701fce Revert support for insertvalue and extractvalue instructions for the moment.
GVN expects that all inputs which to an instruction fall somewhere in the value
hierarchy, which isn't true for these.

llvm-svn: 52496
2008-06-19 17:25:39 +00:00
Dan Gohman 68f539e807 Delete dead code.
llvm-svn: 52494
2008-06-19 17:18:39 +00:00
Matthijs Kooijman 0c71732497 Use a CallSite to find the nth argument of a call/invoke instruction instead of
using getOperand() directly. This makes things work with invoke instructions as
well.

llvm-svn: 52489
2008-06-19 08:53:24 +00:00
Owen Anderson 3ea800fbad Add support for extractvalue and insertvalue instructions in GVN.
llvm-svn: 52472
2008-06-18 21:59:00 +00:00
Owen Anderson 6a903bc601 Add local PRE to GVN. This only operates in cases where it would not increase code size, namely when the instantiated expression
would only need to be created in one predecessor.

llvm-svn: 52471
2008-06-18 21:41:49 +00:00
Chris Lattner 78119b4742 Fix the regressions on sext-misc.ll my patch yesterday caused.
llvm-svn: 52466
2008-06-18 18:11:55 +00:00
Owen Anderson 9094cc957e Revert r52459, which was causing an infinite loop or massive slowdown on MultiSource/Applications/SPASS, and possibly others as well.
Please reapply once this is fixed.

llvm-svn: 52465
2008-06-18 17:32:16 +00:00
Dan Gohman be928e3b21 Move LSR's private isZero function to a public SCEV member
function, and make use of it in several places.

llvm-svn: 52463
2008-06-18 16:23:07 +00:00
Matthijs Kooijman 964557fdf5 Rewrite the DeadArgumentElimination pass, to use a more explicit tracking of
dependencies between return values and/or arguments. Also make the handling of
arguments and return values the same.

The pass now looks properly inside returned structs, but only at the first                                                                                     
level (ie, not inside nested structs).

Also add a testcase for testing various variations of (multiple) dead rerturn
values.

llvm-svn: 52459
2008-06-18 11:12:53 +00:00
Matthijs Kooijman fd17357643 Reapply r52397 (make IPConstProp promote returned arguments), but fixed this
time. Sorry for the trouble!

This time, also add a testcase, which I should have done in the first place...

llvm-svn: 52455
2008-06-18 08:30:37 +00:00
Matthijs Kooijman 97034598b1 Reapply r52396, it was unrelated to the breakage (that was caused by r52397, my
commit after this).

llvm-svn: 52453
2008-06-18 08:09:27 +00:00
Chris Lattner ef36dcd10b implement some simple bswap optimizations, rdar://5992453
llvm-svn: 52442
2008-06-18 04:33:20 +00:00
Chris Lattner b5ee8b3e89 make truncate/sext elimination capable of changing phi's. This
implements rdar://6013816 and the testcase in Transforms/InstCombine/sext-misc.ll.

llvm-svn: 52440
2008-06-18 04:00:49 +00:00
Devang Patel cd6b697945 Preserve dominance frontier while trivially unswitching loop.
llvm-svn: 52438
2008-06-18 02:16:38 +00:00
Owen Anderson 75f3732b23 We don't want to find dependencies within the same block in this case. It leads to incorrect results because
we're detecting something at or after the call we're querying on.

llvm-svn: 52433
2008-06-17 22:27:06 +00:00
Chris Lattner aecc3750d1 revert recent patch which is causing widespread breakage.
llvm-svn: 52415
2008-06-17 17:06:43 +00:00
Duncan Sands 4b50fde2c4 Fix typo that changed the logic to something wrong.
Spotted by Nick Lewycky.

llvm-svn: 52411
2008-06-17 15:55:30 +00:00
Matthijs Kooijman 332836d68d Learn IPConstProp to propagate arguments that are directly returned. Strictly
speaking these are not constant values. However, when a function always returns
one of its arguments, then from the point of view of each caller the return
value is constant (or at least a known value) and can be replaced.

llvm-svn: 52397
2008-06-17 12:20:24 +00:00
Matthijs Kooijman f03c1ae407 Learn IPConstProp to look at individual return values and propagate them
individually.

Also learn IPConstProp how returning first class aggregates work, in addition
to old style multiple return instructions.

Modify the return-constants testscase to confirm this behaviour.

llvm-svn: 52396
2008-06-17 12:02:52 +00:00
Dan Gohman ab0dccba6b Refine the change in r52258 for avoiding use-before-def conditions
when changing the stride of a comparison so that it's slightly
more precise, by having it scan the instruction list to determine
if there is a use of the condition after the point where the
condition will be inserted.

llvm-svn: 52371
2008-06-16 22:34:15 +00:00
Evan Cheng 319e9a4f63 Switch over to SetVector to ensure same order of iterations do not vary across runs.
llvm-svn: 52361
2008-06-16 21:08:17 +00:00
Evan Cheng a72cdcd1a2 Iterating over SmallPtrSet is not deterministic.
llvm-svn: 52339
2008-06-16 18:17:09 +00:00
Matthijs Kooijman 86cda9e050 Pass around Instruction* instead of Instruction& in FindInsertedValue and friends.
llvm-svn: 52318
2008-06-16 13:13:08 +00:00
Matthijs Kooijman 5cb387735d 80 column fixes.
llvm-svn: 52316
2008-06-16 12:57:37 +00:00
Matthijs Kooijman e92e18be5a Move FindScalarValue from InstructionCombining.cpp to ValueTracking.cpp. While
I'm at it, rename it to FindInsertedValue.

The only functional change is that newly created instructions are no longer
added to instcombine's worklist, but that is not really necessary anyway (and
I'll commit some improvements next that will completely remove the need).

llvm-svn: 52315
2008-06-16 12:48:21 +00:00
Chris Lattner 1c9922703f Fix the crash on SimplifyLibCalls/2005-05-20-sprintf-crash.ll
llvm-svn: 52295
2008-06-16 04:10:21 +00:00
Chris Lattner a88cd4ea2a Fix a case where tailcallelim wouldn't set the changed bit when it made a change.
llvm-svn: 52267
2008-06-14 00:49:48 +00:00
Eli Friedman 5de0a77a9b Don't skip over instructions other than loads that might read memory
when trying to sink stores.

llvm-svn: 52259
2008-06-13 22:02:12 +00:00
Dan Gohman 9ad8c54aab Protect ChangeCompareStride from situations in which it is possible
for it to generate use-before-def IR, such as in this testcase.

llvm-svn: 52258
2008-06-13 21:43:41 +00:00
Eli Friedman 9833a1b407 Make sure SimplifyStoreAtEndOfBlock doesn't mess with loops; the
structure checks are incorrect if the blocks aren't distinct.
Fixes PR2435.

llvm-svn: 52257
2008-06-13 21:17:49 +00:00
Wojciech Matyjewicz 25a7f5de92 Use recently added getTruncateOrZeroExtend method to make the code shorter.
llvm-svn: 52251
2008-06-13 17:02:03 +00:00
Gabor Greif 431e9560b7 fix a minor deviation from the original in my previous commit
llvm-svn: 52247
2008-06-12 21:51:29 +00:00
Gabor Greif f6d8e77027 op_iterator-ify some loops, low hanging fruit only, there is more
llvm-svn: 52246
2008-06-12 21:37:33 +00:00
Evan Cheng 89553cc42e Do not speculatively execute an instruction by hoisting it to its predecessor BB if any of its operands are defined but not used in BB. The transformation will prevent the operand from being sunk into the use block.
llvm-svn: 52244
2008-06-12 21:15:59 +00:00
Evan Cheng 70fe16353a Revert 52223.
llvm-svn: 52243
2008-06-12 20:55:39 +00:00