summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
...
* Add a proper LLVM banner to this file.Chandler Carruth2011-10-161-0/+13
| | | | llvm-svn: 142162
* When looking for dependencies on the src pointer, scan the src pointer. ScanningNick Lewycky2011-10-161-12/+17
| | | | | | on the memcpy call will pull up other unrelated stuff. Fixes PR11142. llvm-svn: 142150
* Don't replace all dominated uses if there is only one use, since thatDuncan Sands2011-10-151-4/+9
| | | | | | use can't be dominated, saving one domtree lookup. llvm-svn: 142066
* Fix indvars randomness by removing iteration over a map.Andrew Trick2011-10-151-12/+12
| | | | | | | | | | | | | I rewrote the algorithm a while back so it doesn't require map lookup, but neglected to change the data structure. This was caught by llvm-gcc self host, not because there's anything special about llvm-gcc, but because it is the only test for nondeterminism we currently have. Unit tests don't work well for everything; we should always try to have a nondeterminism stress test running. Fixes PR11133: llvm-gcc self host .o mismatch after enable-iv-rewrite=false llvm-svn: 142036
* Avoid undefined behavior in negation in LSR. Patch by Ahmed Charles.Eli Friedman2011-10-131-2/+2
| | | | | | Someone more familiar with LSR should double-check that the extra cast is actually doing the right thing in the overflow cases; I'm not completely confident that's that case. llvm-svn: 141916
* Enhance the memdep interface so that users can tell the difference between a ↵Eli Friedman2011-10-132-13/+13
| | | | | | | | dependency which cannot be calculated and a path reaching the entry point of the function. This patch introduces isNonFuncLocal, which replaces isUnknown in some cases. Patch by Xiaoyi Guo. llvm-svn: 141896
* Fix a couple hash functions so that they do not depend on undefined shifts. ↵Eli Friedman2011-10-121-2/+2
| | | | | | Based on patch by Ahmed Charles. llvm-svn: 141820
* Add missing space.Nick Lewycky2011-10-121-1/+1
| | | | llvm-svn: 141750
* Fix PR11106 by correcting a typo that has been in the code for over a year. ThisCameron Zwarich2011-10-111-2/+2
| | | | | | | | would have never worked, since the element type of a vector type is never a vector type. Also fix the conditional to be more direct in checking whether EltTy is a vector type. llvm-svn: 141713
* Remove a lot of the fancy scalar replacement code for dealing with llvm-gcc'sCameron Zwarich2011-10-111-205/+16
| | | | | | | lowering of NEON code. It provides little-to-no benefit now and only introduces additional complexity. llvm-svn: 141646
* Add experimental -enable-lsr-phielim option.Andrew Trick2011-10-111-0/+22
| | | | | | | I'm not sure we will need it in the long run, but the option is currently useful for checking if the output of LSR is "clean". llvm-svn: 141634
* Move replaceCongruentIVs into SCEVExapander and bias toward "expanded"Andrew Trick2011-10-111-87/+6
| | | | | | | | | | | IVs. Indvars previously chose randomly between congruent IVs. Now it will bias the decision toward IVs that SCEVExpander likes to create. This was not done to fix any problem, it's just a welcome side effect of factoring code. llvm-svn: 141633
* Add a natural stack alignment field to TargetData, and prevent InstCombine fromLang Hames2011-10-101-2/+6
| | | | | | | | | | | | | | promoting allocas to preferred alignments that exceed the natural alignment. This avoids some potentially expensive dynamic stack realignments. The natural stack alignment is set in target data strings via the "S<size>" option. Size is in bits and must be a multiple of 8. The natural stack alignment defaults to "unspecified" (represented by a zero value), and the "unspecified" value does not prevent any alignment promotions. Target maintainers that care about avoiding promotions should explicitly add the "S<size>" option to their target data strings. llvm-svn: 141599
* LSR should only reuse phis that match its formula.Andrew Trick2011-10-071-0/+1
| | | | | | Fixes rdar://problem/5064068 llvm-svn: 141442
* Teach GVN to also propagate switch cases. For example, in this codeDuncan Sands2011-10-071-31/+59
| | | | | | | | | | | | | | switch (n) { case 27: do_something(x); ... } the call do_something(x) will be replaced with do_something(27). In gcc-as-one-big-file this results in the removal of about 500 lines of bitcode (about 0.02%), so has about 1/10 of the effect of propagating branch conditions. llvm-svn: 141360
* Remove the old atomic instrinsics. autoupgrade functionality is included ↵Eli Friedman2011-10-061-98/+1
| | | | | | with this patch. llvm-svn: 141333
* PR11061: Make simplifylibcalls fold strcmp("", x) correctly.Eli Friedman2011-10-051-13/+18
| | | | | | While I'm here, fix the related issue with strncmp, add some actual tests for strcmp and strncmp, and start using StringRef::compare for constant folding instead of using strcmp/strncmp so that the optimized IR isn't dependent on the host's implementation of strcmp. llvm-svn: 141227
* Re-commit 141203, but much more conservative.Jim Grosbach2011-10-051-3/+3
| | | | | | | | Just pull the instruction name, but don't change the order of anything else. That keeps --debug happy and non-crashing, but doesn't change how the worklist gets built. llvm-svn: 141210
* Revert 141203. InstCombine is looping on unit tests.Jim Grosbach2011-10-051-9/+8
| | | | llvm-svn: 141209
* Update InstCombine worklist after instruction transform is complete.Jim Grosbach2011-10-051-8/+9
| | | | | | | | | | | | When updating the worklist for InstCombine, the Add/AddUsersToWorklist functions may access the instruction(s) being added, for debug output for example. If the instructions aren't yet added to the basic block, this can result in a crash. Finish the instruction transformation before adjusting the worklist instead. rdar://10238555 llvm-svn: 141203
* GVN does simple propagation of conditions: when it sees a conditionalDuncan Sands2011-10-051-14/+111
| | | | | | | | | | | | | | | | | | | branch "br i1 %x, label %if_true, label %if_false" then it replaces "%x" with "true" in places only reachable via the %if_true arm, and with "false" in places only reachable via the %if_false arm. Except that actually it doesn't: if value numbering shows that %y is equal to %x then, yes, %y will be turned into true/false in this way, but any occurrences of %x itself are not transformed. Fix this. What's more, it's often the case that %x is an equality comparison such as "%x = icmp eq %A, 0", in which case every occurrence of %A that is only reachable via the %if_true arm can be replaced with 0. Implement this and a few other variations on this theme. This reduces the number of lines of LLVM IR in "GCC as one big file" by 0.2%. It has a bigger impact on Ada code, typically reducing the number of lines of bitcode by around 0.4% by removing repeated compiler generated checks. Passes the LLVM nightly testsuite and the Ada ACATS testsuite. llvm-svn: 141177
* Generalize GVN's conditional propagation logic slightly:Duncan Sands2011-10-051-4/+29
| | | | | | | | it's OK for the false/true destination to have multiple predecessors as long as the extra ones are dominated by the branch destination. llvm-svn: 141176
* LSR should avoid redundant edge splitting.Andrew Trick2011-10-042-3/+6
| | | | | | | | This handles the case in which LSR rewrites an IV user that is a phi and splits critical edges originating from a switch. Fixes <rdar://problem/6453893> LSR is not splitting edges "nicely" llvm-svn: 141059
* whitespaceAndrew Trick2011-10-041-18/+18
| | | | llvm-svn: 141058
* Add a new icmp+select optz'n. Also shows off the load(cst) folding added inNick Lewycky2011-10-021-0/+6
| | | | | | r140966. llvm-svn: 140969
* Enhance a couple places where we were doing constant folding of instructions,Nick Lewycky2011-10-022-7/+8
| | | | | | but not load instructions. Noticed by inspection. llvm-svn: 140966
* Inlining and unrolling heuristics should be aware of free truncs.Andrew Trick2011-10-013-3/+11
| | | | | | | | | | We want heuristics to be based on accurate data, but more importantly we don't want llvm to behave randomly. A benign trunc inserted by an upstream pass should not cause a wild swings in optimization level. See PR11034. It's a general problem with threshold-based heuristics, but we can make it less bad. llvm-svn: 140919
* whitespaceAndrew Trick2011-10-012-18/+18
| | | | llvm-svn: 140916
* Don't modify constant in-place.Jim Grosbach2011-09-301-3/+4
| | | | llvm-svn: 140875
* float comparison to double 'zero' constant can just be a float 'zero.'Jim Grosbach2011-09-301-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | InstCombine was incorrectly considering the conversion of the constant zero to be unsafe. We want to transform: define float @bar(float %x) nounwind readnone optsize ssp { %conv = fpext float %x to double %cmp = fcmp olt double %conv, 0.000000e+00 %conv1 = zext i1 %cmp to i32 %conv2 = sitofp i32 %conv1 to float ret float %conv2 } Into: define float @bar(float %x) nounwind readnone optsize ssp { %cmp = fcmp olt float %x, 0.000000e+00 ; <---- This %conv1 = zext i1 %cmp to i32 %conv2 = sitofp i32 %conv1 to float ret float %conv2 } rdar://10215914 llvm-svn: 140869
* Tidy up. Trailing whitespace.Jim Grosbach2011-09-301-220/+220
| | | | llvm-svn: 140865
* Inlining often produces landingpad instructions with repeatedDuncan Sands2011-09-302-0/+338
| | | | | | | | | | | | | | catch or repeated filter clauses. Teach instcombine a bunch of tricks for simplifying landingpad clauses. Currently the code only recognizes the GNU C++ and Ada personality functions, but that doesn't stop it doing a bunch of "generic" transforms which are hopefully fine for any real-world personality function. If these "generic" transforms turn out not to be generic, they can always be conditioned on the personality function. Probably someone should add the ObjC++ personality function. I didn't as I don't know anything about it. llvm-svn: 140852
* Fold two identical set lookups into one. No functionality change.Nick Lewycky2011-09-291-4/+2
| | | | llvm-svn: 140821
* When eliminating unnecessary retain+autorelease on return values,Dan Gohman2011-09-291-1/+2
| | | | | | | handle the case where the retain is in a different basic block. rdar://10210274. llvm-svn: 140815
* Don't eliminate objc_retainBlock calls on stack objects if theDan Gohman2011-09-291-8/+29
| | | | | | | objc_retainBlock call is potentially responsible for copying the block to the heap to extend its lifetime. rdar://10209613. llvm-svn: 140814
* Clean up uses of switch instructions so they are not dependent on the ↵Eli Friedman2011-09-292-7/+13
| | | | | | operand ordering. Patch by Stepan Dyatkovskiy. llvm-svn: 140803
* typo + pastoAndrew Trick2011-09-291-2/+2
| | | | llvm-svn: 140769
* LSR: rewrite inner loops only.Andrew Trick2011-09-291-5/+21
| | | | | | | | Rewriting the entire loop nest now requires -enable-lsr-nested. See PR11035 for some performance data. A few unit tests specifically test nested LSR, and are now under a flag. llvm-svn: 140762
* indvars should hoist [sz]ext because licm is not rerun.Andrew Trick2011-09-281-17/+27
| | | | llvm-svn: 140670
* Stop emitting instructions with the name "tmp" they eat up memory and have ↵Benjamin Kramer2011-09-2713-102/+79
| | | | | | | | to be uniqued, without any benefit. If someone prefers %tmp42 to %42, run instnamer. llvm-svn: 140634
* Split the landing pad basic block with the correct function. Also merge theBill Wendling2011-09-271-3/+23
| | | | | | | split landingpad instructions into a PHI node. PR11016 llvm-svn: 140592
* Disable LSR retry by default.Andrew Trick2011-09-271-0/+16
| | | | | | | Disabling aggressive LSR saves compilation time, and with the new indvars behavior usually improves performance. llvm-svn: 140590
* LSR, one of the new Cost::isLoser() checks did not get merged in the ↵Andrew Trick2011-09-261-2/+6
| | | | | | previous checkin. llvm-svn: 140583
* LSR cost metric minor fix and verification.Andrew Trick2011-09-261-3/+26
| | | | | | | | The minor bug heuristic was noticed by inspection. I added the isLoser/isValid helpers because they will become more important with subsequent checkins. llvm-svn: 140580
* LSR minor bug fix in RateRegister.Andrew Trick2011-09-231-1/+1
| | | | | | | No test case. Noticed by inspection and I doubt it ever affects the outcome of the overall heuristic, let alone final codegen. llvm-svn: 140431
* PR10987: add a missed safety check to isSafePHIToSpeculate in scalarrepl.Eli Friedman2011-09-221-7/+11
| | | | llvm-svn: 140327
* Make sure IPSCCP never marks a tracked call as overdefined in ↵Eli Friedman2011-09-201-9/+35
| | | | | | | | SCCPSolver::ResolvedUndefsIn. If we do, we can end up in a situation where a function is resolved to return a constant, but the caller is marked overdefined, which confuses the code later. <rdar://problem/9956541> (again). llvm-svn: 140210
* Relax this condition.Bill Wendling2011-09-201-2/+1
| | | | | | | Some passes require breaking critical edges before they're called. Don't segfault because of that. llvm-svn: 140196
* Place the check for an exit landing pad where it will be run on both code ↵Bill Wendling2011-09-201-6/+15
| | | | | | paths through the if-then-else. llvm-svn: 140195
* Omit extracting a loop if one of the exits is a landing pad.Bill Wendling2011-09-201-5/+11
| | | | | | | | | The landing pad must accompany the invoke when it's extracted. However, if it does, then the loop isn't properly extracted. I.e., the resulting extraction has a loop in it. The extracted function is then extracted, etc. resulting in an infinite loop. llvm-svn: 140193
OpenPOWER on IntegriCloud