aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms
AgeCommit message (Collapse)Author
2008-12-23Revert 61362 and 61402 until SPEC breakage is fixed.Dale Johannesen
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61403 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-23This fixes the bug in 175.vpr. It doesn't fix theDale Johannesen
other SPEC breakage. I'll be reverting all recent changes shortly, this checking is mostly so this change doesn't get lost. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61402 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-23Fix the time regression I introduced in 464.h264ref withDale Johannesen
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61362 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-23Don't forget to remove phi nodes from the value numbering table after we ↵Owen Anderson
collapse them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61358 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-22Comment clean-ups. No functionality change.Bill Wendling
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61354 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-22Check that the instruction isn't in the value numbering scope.Bill Wendling
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61353 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-22Simplification: Negate the operator== method instead of implementing a full ↵Bill Wendling
operator!= method. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61352 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-22Add verification that deleted instruction isn't hiding in the PHI map.Bill Wendling
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61350 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-22Verify removed in a few more places.Bill Wendling
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61349 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-22Add verification functions to GVN which check to see that an instruction wasBill Wendling
truely deleted. These will be expanded with further checks of all of the data structures. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61347 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-21Turn strcmp into memcmp, such as strcmp(P, "x") --> memcmp(P, "x", 2).Nick Lewycky
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61297 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-20Remove redundant test for vector-nature. Scan the vector first to see whetherNick Lewycky
our optz'n will apply to it, then build the replacement vector only if needed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61279 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-19- CodeGenPrepare does not split loop back edges but it only knows about back ↵Evan Cheng
edges of single block loops. It now does a DFS walk to find loop back edges. - Use SplitBlockPredecessors to factor out common predecessors of the critical edge destination. This is disabled for now due to some regressions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61248 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-18Didn't mean to commit this.Bill Wendling
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61222 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-18Re-XFAIL this test until debug stuff settles down.Bill Wendling
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61219 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-18Oops! Left out a line.Nick Lewycky
Simplifying the sdiv might allow further simplifications for our users. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61196 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-18Make all the vector elements positive in an srem of constant vector.Nick Lewycky
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61195 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-18Fix PR2929 by making bugpoint/code extract propagate the nothrowChris Lattner
bit from the original function to the cloned one. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61194 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-18Revert previous patch, appears to break bootstrap.Dale Johannesen
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61181 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-18Fix the time regression I introduced in 464.h264ref withDale Johannesen
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. (This patch does not handle all the cases where this can happen.) 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. Everything above is exercised in CodeGen/X86/lsr-negative-stride.ll (and ifcvt4 in ARM which is the same IR). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61178 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-18reapply this hunk from Bill's reversion in r61169, it is conservativeChris Lattner
and safe and orthogonal from turning off load pre. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61177 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-18make instnamer name unnamed blocks as well as instructions and args.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61175 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-17Temporarily revert r61027. It was causing a bootstrap failure in "release" modeBill Wendling
with everyone's favorite error messages: Comparing stages 2 and 3 warning: ./cc1-checksum.o differs warning: ./cc1plus-checksum.o differs Bootstrap comparison failure! ./c-decl.o differs ./cp/decl.o differs ./df-core.o differs ./gcc.o differs ./i386.o differs ./stor-layout.o differs ./tree-pretty-print.o differs ./tree.o differs make[2]: *** [compare] Error 1 make[1]: *** [stage3-bubble] Error 2 See PR3227. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61169 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-17insert some sequence points and preincrement an iterator to avoidChris Lattner
iterator invalidation problems. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61124 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-17Enhance heap sra to be substantially more aggressive w.r.t PHIChris Lattner
nodes. This allows it to do fairly general phi insertion if a load from a pointer global wants to be SRAd but the load is used by (recursive) phi nodes. This fixes a pessimization on ppc introduced by Load PRE. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61123 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16Clarify that the scale factor from CheckForIVReuseDale Johannesen
can be negative. Keep track of whether all uses of an IV are outside the loop. Some cosmetics; no functional change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61109 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16Fix another crash found by inspection. If we have a PHI node mergingChris Lattner
the load multiple times, make sure the check the uses of the PHI to ensure they are transformable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61102 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16fix a crash found by inspection.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61101 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16Add a helper to remove a branch and DCE the condition, and use it Eli Friedman
consistently for deleting branches. In addition to being slightly more readable, this makes SimplifyCFG a bit better about cleaning up after itself when it makes conditions unused. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61100 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16switch some std::set/std::map to SmallPtrSet/DenseMap.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61081 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-15enhance heap-sra to apply to fixed sized array allocations, not justChris Lattner
variable sized array allocations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61051 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-15Use stripPointerCasts.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61047 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-15minor tweaks for formatting, allow bitcast in ↵Chris Lattner
ValueIsOnlyUsedLocallyOrStoredToOneGlobal. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61046 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-15refactor some code into a new TryToOptimizeStoreOfMallocToGlobal function.Chris Lattner
Use GetElementPtrInst::hasAllZeroIndices where possible. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61045 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-15Enable Load PRE. This teaches GVN to push partially redundant loads up theChris Lattner
CFG when there is exactly one predecessor where the load is not available. This is designed to not increase code size but still eliminate partially redundant loads. This fires 1765 times on 403.gcc even though it doesn't do critical edge splitting yet (the most common reason for it to fail). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61027 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-15Ifdef out some code that I didn't mean to enable by default yet.Owen Anderson
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61024 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-15make GVN try to rename inputs to the resultant replaced values, whichChris Lattner
cleans up the generated code a bit. This should have the added benefit of not randomly renaming functions/globals like my previous patch did. :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61023 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-15Add support for slow-path GVN with full phi construction for scalars. This ↵Owen Anderson
is disabled for now, as it actually pessimizes code in the abscence of phi translation for load elimination. This slow down GVN a bit, by about 2% on 403.gcc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61021 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-14eliminate warning when asserts disabled.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61012 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-14Generalize GVN's phi construciton routine to work for things other than loads.Owen Anderson
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61009 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-13Temporarily revert r60973. It's inexplicably causing a failure when ↵Bill Wendling
self-hosting LLVM: llvm[2]: Linking Release executable opt (without symbols) ... Undefined symbols: "llvm::APFloat::IEEEsingle", referenced from: __ZN4llvm7APFloat10IEEEsingleE$non_lazy_ptr in libLLVMCore.a(Constants.o) __ZN4llvm7APFloat10IEEEsingleE$non_lazy_ptr in libLLVMCore.a(AsmWriter.o) __ZN4llvm7APFloat10IEEEsingleE$non_lazy_ptr in libLLVMCore.a(ConstantFold.o) "llvm::APFloat::IEEEdouble", referenced from: __ZN4llvm7APFloat10IEEEdoubleE$non_lazy_ptr in libLLVMCore.a(Constants.o) __ZN4llvm7APFloat10IEEEdoubleE$non_lazy_ptr in libLLVMCore.a(AsmWriter.o) __ZN4llvm7APFloat10IEEEdoubleE$non_lazy_ptr in libLLVMCore.a(ConstantFold.o) ld: symbol(s) not found This is in release mode. To replicate, compile llvm and llvm-gcc in optimized mode. Then build llvm, in optimized mode, with the newly created compiler. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60977 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-13make RLE preserve the name of the load that it replaces. This is justChris Lattner
a pretification of the IR. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60973 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-13Fix spelling.Misha Brukman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60971 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09Teach GVN to invalidate some memdep information when it does an RAUWChris Lattner
of a pointer. This allows is to catch more equivalencies. For example, the type_lists_compatible_p function used to require two iterations of the gvn pass (!) to delete its 18 redundant loads because the first pass would CSE all the addressing computation cruft, which would unblock the second memdep/gvn passes from recognizing them. This change allows memdep/gvn to catch all 18 when run just once on the function (as is typical :) instead of just 3. On all of 403.gcc, this bumps up the # reundandancies found from: 63 gvn - Number of instructions PRE'd 153991 gvn - Number of instructions deleted 50069 gvn - Number of loads deleted to: 63 gvn - Number of instructions PRE'd 154137 gvn - Number of instructions deleted 50185 gvn - Number of loads deleted +120 loads deleted isn't bad. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60799 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09rename getNonLocalDependency -> getNonLocalCallDependency, and removeChris Lattner
pointer stuff from it, simplifying the code a bit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60783 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09Switch GVN::processNonLocalLoad to using the new Chris Lattner
MemDep::getNonLocalPointerDependency method. There are some open issues with this (missed optimizations) and plenty of future work, but this does allow GVN to eliminate *slightly* more loads (49246 vs 49033). Switching over now allows simplification of the other code path in memdep. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60780 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09random cleanups, no functionality change.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60779 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09Fix a really subtle off-by-one bug that Duncan noticed with valgrindChris Lattner
on test/CodeGen/Generic/2007-06-06-CriticalEdgeLandingPad. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60739 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08remove DebugIterations option. Despite the accusations, Chris Lattner
jump threading has been shown to only expose problems not have bugs itself. I'm sure it's completely bug free! ;-) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60725 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08Fix spelling. Devang Patel
Thanks Duncan! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60702 91177308-0d34-0410-b5e6-96231b3b80d8