summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* fix typo Duncan noticed.Chris Lattner2009-01-091-1/+1
| | | | llvm-svn: 61997
* Fix PR3304Chris Lattner2009-01-091-2/+12
| | | | llvm-svn: 61995
* Removed trailing whitespace from Makefiles.Misha Brukman2009-01-096-14/+14
| | | | llvm-svn: 61991
* Implement rdar://6480391, extending of equality icmp's to avoid a truncation.Chris Lattner2009-01-091-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I noticed this in the code compiled for a routine using std::map, which produced this code: %25 = tail call i32 @memcmp(i8* %24, i8* %23, i32 6) nounwind readonly %.lobit.i = lshr i32 %25, 31 ; <i32> [#uses=1] %tmp.i = trunc i32 %.lobit.i to i8 ; <i8> [#uses=1] %toBool = icmp eq i8 %tmp.i, 0 ; <i1> [#uses=1] br i1 %toBool, label %bb3, label %bb4 which compiled to: call L_memcmp$stub shrl $31, %eax testb %al, %al jne LBB1_11 ## with this change, we compile it to: call L_memcmp$stub testl %eax, %eax js LBB1_11 This triggers all the time in common code, with patters like this: %169 = and i32 %ply, 1 ; <i32> [#uses=1] %170 = trunc i32 %169 to i8 ; <i8> [#uses=1] %toBool = icmp ne i8 %170, 0 ; <i1> [#uses=1] %7 = lshr i32 %6, 24 ; <i32> [#uses=1] %9 = trunc i32 %7 to i8 ; <i8> [#uses=1] %10 = icmp ne i8 %9, 0 ; <i1> [#uses=1] etc llvm-svn: 61985
* Remove some old code that looks like a remanant from signed-types days.Chris Lattner2009-01-091-23/+0
| | | | llvm-svn: 61984
* Fix PR3298, a crash in Jump Threading. Apparently even Chris Lattner2009-01-091-0/+4
| | | | | | jump threading can have bugs, who knew? ;-) llvm-svn: 61983
* Fix part 3/2 of PR3290, making instcombine zap (gep(bitcast)) when possible.Chris Lattner2009-01-091-81/+116
| | | | llvm-svn: 61980
* move some code, check to see if the input to the GEP is a bitcastChris Lattner2009-01-091-23/+22
| | | | | | (which is constant time and cheap) before checking hasAllZeroIndices. llvm-svn: 61976
* Adjustments to last patch based on review.Dale Johannesen2009-01-094-11/+24
| | | | llvm-svn: 61969
* Do not inline functions with (dynamic) alloca intoDale Johannesen2009-01-081-2/+20
| | | | | | | | | | | functions that don't already have a (dynamic) alloca. Dynamic allocas cause inefficient codegen and we shouldn't propagate this (behavior follows gcc). Two existing tests assumed such inlining would be done; they are hacked by adding an alloca in the caller, preserving the point of the tests. llvm-svn: 61946
* This implements the second half of the fix for PR3290, handlingChris Lattner2009-01-081-2/+99
| | | | | | | | | loads from allocas that cover the entire aggregate. This handles some memcpy/byval cases that are produced by llvm-gcc. This triggers a few times in kc++ (with std::pair<std::_Rb_tree_const_iterator <kc::impl_abstract_phylum*>,bool>) and once in 176.gcc (with %struct..0anon). llvm-svn: 61915
* Whitespace - correct formatting.Duncan Sands2009-01-071-2/+2
| | | | llvm-svn: 61879
* Remove alloca tracking from nocapture analysis. Not onlyDuncan Sands2009-01-071-69/+16
| | | | | | | | | | was it not very helpful, it was also wrong! The problem is shown in the testcase: the alloca might be passed to a nocapture callee which dereferences it and returns the original pointer. But because it was a nocapture call we think we don't need to track its uses, but we do. llvm-svn: 61876
* Reorder these.Duncan Sands2009-01-071-24/+24
| | | | llvm-svn: 61873
* Use a switch rather than a sequence of "isa" tests.Duncan Sands2009-01-071-16/+32
| | | | llvm-svn: 61872
* The verifier checks that the aliasee is not null.Duncan Sands2009-01-071-2/+1
| | | | llvm-svn: 61870
* Implement the first half of PR3290: if there is a store of an Chris Lattner2009-01-071-5/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | integer to a (transitive) bitcast the alloca and if that integer has the full size of the alloca, then it clobbers the whole thing. Handle this by extracting pieces out of the stored integer and filing them away in the SROA'd elements. This triggers fairly frequently because the CFE uses integers to pass small structs by value and the inliner exposes these. For example, in kimwitu++, I see a bunch of these with i64 stores to "%struct.std::pair<std::_Rb_tree_const_iterator<kc::impl_abstract_phylum*>,bool>" In 176.gcc I see a few i32 stores to "%struct..0anon". In the testcase, this is a difference between compiling test1 to: _test1: subl $12, %esp movl 20(%esp), %eax movl %eax, 4(%esp) movl 16(%esp), %eax movl %eax, (%esp) movl (%esp), %eax addl 4(%esp), %eax addl $12, %esp ret vs: _test1: movl 8(%esp), %eax addl 4(%esp), %eax ret The second half of this will be to handle loads of the same form. llvm-svn: 61853
* Factor a bunch of code out into a helper method.Chris Lattner2009-01-071-148/+156
| | | | llvm-svn: 61852
* use continue to simplify code and reduce nesting, no functionalityChris Lattner2009-01-071-38/+58
| | | | | | change. llvm-svn: 61851
* Get TargetData once up front and cache as an ivar instead ofChris Lattner2009-01-071-45/+38
| | | | | | requerying it all over the place. llvm-svn: 61850
* Use the hasAllZeroIndices predicate to simplify some Chris Lattner2009-01-071-28/+6
| | | | | | code, no functionality change. llvm-svn: 61849
* Change m_ConstantInt and m_SelectCst to take their constant integersChris Lattner2009-01-051-9/+9
| | | | | | | as template arguments instead of as instance variables, exposing more optimization opportunities to the compiler earlier. llvm-svn: 61776
* Teach the internalize pass to also internalizeDuncan Sands2009-01-051-0/+12
| | | | | | global aliases. llvm-svn: 61754
* Find loop back edges only after empty blocks are eliminated.Evan Cheng2009-01-051-2/+3
| | | | llvm-svn: 61752
* Not having an aliasee is a theoretical possibility.Duncan Sands2009-01-051-1/+2
| | | | llvm-svn: 61745
* Format more neatly.Duncan Sands2009-01-051-1/+1
| | | | llvm-svn: 61744
* Remove trailing spaces.Duncan Sands2009-01-051-10/+10
| | | | llvm-svn: 61743
* Delete unused global aliases with internal linkage.Duncan Sands2009-01-051-8/+23
| | | | | | | | In fact this also deletes those with linkonce linkage, however this is currently dead because for the moment aliases aren't allowed to have this linkage type. llvm-svn: 61742
* Tidy up #includes, deleting a bunch of unnecessary #includes.Dan Gohman2009-01-051-1/+0
| | | | llvm-svn: 61715
* Move the libcall annotating part from doFinalization to doInitialization.Nick Lewycky2009-01-051-18/+77
| | | | | | | | | | | | | Finalization occurs after all the FunctionPasses in the group have run, which is clearly not what we want. This also means that we have to make sure that we apply the right param attributes when creating a new function. Also, add a missed optimization: strdup and strndup. NoCapture and NoAlias return! llvm-svn: 61658
* Run a post-pass that marks known function declarations by name.Nick Lewycky2009-01-041-0/+443
| | | | llvm-svn: 61632
* Revert this transform. It was causing some dramatic slowdowns in a few ↵Bill Wendling2009-01-041-31/+0
| | | | | | tests. See PR3266. llvm-svn: 61623
* Any void readonly functions are provably dead, don't waste time adding Nick Lewycky2009-01-031-14/+0
| | | | | | nocapture attributes to them. llvm-svn: 61610
* Load tracking means that the value analyzed mayDuncan Sands2009-01-021-2/+8
| | | | | | | | | | | | not have pointer type. In particular, it may be the condition argument for a select or a GEP index. While I was unable to construct a testcase for which some bits of the original pointer are captured due to one of these, it's very very close to being possible - so play safe and exclude these possibilities. llvm-svn: 61580
* When calculating 'nocapture' argument attributes, allowDuncan Sands2009-01-021-21/+60
| | | | | | | | | | | | the argument to be stored to an alloca by tracking uses of the alloca. This occurs 4 times (out of 7121, 0.05%) in MultiSource/Applications, so may not be worth it. On the other hand, it is easy to do and fairly cheap. The functions it helps are: W_addcom and W_addlit in spiff; process_args (argv) in d (make_dparser); ercPixConcealIMB in JM/ldecod. llvm-svn: 61570
* Improve comments and reorganize a bit - no functionalityDuncan Sands2009-01-021-56/+44
| | | | | | change. llvm-svn: 61569
* Make adding nocapture a bit stronger. FreeInst is nocapture. Also, Nick Lewycky2009-01-021-3/+27
| | | | | | | | | | functions that don't write can't leak a pointer except through the return value, so a void readonly function is implicitly nocapture. Test these, and add a test that verifies that f1 calling f2 with an otherwise dead pointer gets both of them marked nocapture. llvm-svn: 61552
* Mention that this pass does escape analysis in theDuncan Sands2009-01-011-3/+5
| | | | | | leading comments. llvm-svn: 61548
* Fix comment.Bill Wendling2009-01-011-1/+1
| | | | llvm-svn: 61538
* Add transformation:Bill Wendling2009-01-011-1/+32
| | | | | | | | xor (or (icmp, icmp), true) -> and(icmp, icmp) This is possible because of De Morgan's law. llvm-svn: 61537
* Look through phi nodes and select instructions whenDuncan Sands2008-12-311-3/+8
| | | | | | calculating nocapture attributes. llvm-svn: 61535
* Don't analyze arguments already marked 'nocapture'.Duncan Sands2008-12-311-1/+2
| | | | llvm-svn: 61532
* Rename AddReadAttrs to FunctionAttrs, and teach it howDuncan Sands2008-12-312-13/+127
| | | | | | | | to work out (in a very simplistic way) which function arguments (pointer arguments only) are only dereferenced and so do not escape. Mark such arguments 'nocapture'. llvm-svn: 61525
* Experiments show that looking through phi nodesDuncan Sands2008-12-291-0/+2
| | | | | | | | | | and select instructions doesn't buy anything here except extra complexity: the only difference in the entire testsuite was that a readonly function became readnone in MiBench/consumer-typeset. Add a comment about this. llvm-svn: 61478
* Allow readnone functions to read (and write!) globalDuncan Sands2008-12-291-4/+19
| | | | | | | | | | | | | | | | constants, since doing so is irrelevant for aliasing purposes. While this doesn't increase the total number of functions marked readonly or readnone in MultiSource/ Applications (3089), it does result in 12 functions being marked readnone rather than readonly. Before: readnone: 820 readonly: 2269 After: readnone: 832 readonly: 2257 llvm-svn: 61469
* Revert 61362 and 61402 until SPEC breakage is fixed.Dale Johannesen2008-12-231-135/+43
| | | | llvm-svn: 61403
* This fixes the bug in 175.vpr. It doesn't fix theDale Johannesen2008-12-231-2/+9
| | | | | | | | other SPEC breakage. I'll be reverting all recent changes shortly, this checking is mostly so this change doesn't get lost. llvm-svn: 61402
* Fix the time regression I introduced in 464.h264ref withDale Johannesen2008-12-231-41/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | my last patch to this file. The issue there was that all uses of an IV inside a loop are actually references to Base[IV*2], and there was one use outside that was the same but LSR didn't see the base or the scaling because it didn't recurse into uses outside the loop; thus, it used base+IV*scale mode inside the loop instead of pulling base out of the loop. This was extra bad because register pressure later forced both base and IV into memory. Doing that recursion, at least enough to figure out addressing modes, is a good idea in general; the change in AddUsersIfInteresting does this. However, there were side effects.... It is also possible for recursing outside the loop to introduce another IV where there was only 1 before (if the refs inside are not scaled and the ref outside is). I don't think this is a common case, but it's in the testsuite. It is right to be very aggressive about getting rid of such introduced IVs (CheckForIVReuse and the handling of nonzero RewriteFactor in StrengthReduceStridedIVUsers). In the testcase in question the new IV produced this way has both a nonconstant stride and a nonzero base, neither of which was handled before. And when inserting new code that feeds into a PHI, it's right to put such code at the original location rather than in the PHI's immediate predecessor(s) when the original location is outside the loop (a case that couldn't happen before) (RewriteInstructionToUseNewBase); better to avoid making multiple copies of it in this case. Also, the mechanism for keeping SCEV's corresponding to GEP's no longer works, as the GEP might change after its SCEV is remembered, invalidating the SCEV, and we might get a bad SCEV value when looking up the GEP again for a later loop. This also couldn't happen before, as we weren't recursing into GEP's outside the loop. I owe some testcases for this, want to get it in for nightly runs. llvm-svn: 61362
* Don't forget to remove phi nodes from the value numbering table after we ↵Owen Anderson2008-12-231-0/+2
| | | | | | collapse them. llvm-svn: 61358
* Comment clean-ups. No functionality change.Bill Wendling2008-12-221-5/+3
| | | | llvm-svn: 61354
OpenPOWER on IntegriCloud