summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Dust off tail recursion elimination. Fix a fixme by applying CaptureTrackingNick Lewycky2009-11-071-21/+8
| | | | | | and add a .ll to demo the new capability. llvm-svn: 86349
* Revert following patches to fix llvmgcc bootstrap.Devang Patel2009-11-071-350/+234
| | | | | | | 86289, 86278, 86270, 86267, 86266 & 86264 Chris, please take a look. llvm-svn: 86321
* - new SROA mallocs should have the mallocs running-or'ed, not the malloc's ↵Victor Hernandez2009-11-071-19/+22
| | | | | | | | bitcast - fix ProcessInternalGlobal() debug output llvm-svn: 86317
* Avoid "ambiguous 'else'" warning from gcc.Jeffrey Yasskin2009-11-071-1/+2
| | | | llvm-svn: 86314
* Re-commit r86077 now that r86290 fixes the 179.art and 175.vpr ARM regressions.Victor Hernandez2009-11-071-69/+72
| | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 86311
* Fix a bug where we'd call SplitBlockPredecessors with a pred in the Chris Lattner2009-11-061-2/+11
| | | | | | set only once even if it has multiple edges to BB. llvm-svn: 86299
* Remove function left over from other jump threading cleanup.Eli Friedman2009-11-061-24/+0
| | | | llvm-svn: 86289
* Fix a problem discovered on self host.Chris Lattner2009-11-061-1/+1
| | | | llvm-svn: 86278
* remove more code subsumed by r86264Chris Lattner2009-11-061-83/+17
| | | | llvm-svn: 86270
* eliminate some more code subsumed by r86264Chris Lattner2009-11-061-41/+4
| | | | llvm-svn: 86267
* remove now redundant code, r86264 handles this case.Chris Lattner2009-11-061-66/+0
| | | | llvm-svn: 86266
* Extend jump threading to support much more general threadingChris Lattner2009-11-061-27/+325
| | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 86264
* remove some more Context arguments.Chris Lattner2009-11-061-1/+1
| | | | llvm-svn: 86235
* remove a bunch of extraneous LLVMContext argumentsChris Lattner2009-11-069-138/+106
| | | | | | from various APIs, addressing PR5325. llvm-svn: 86231
* Revert r86077 because it caused crashes in 179.art and 175.vpr on ARMVictor Hernandez2009-11-061-74/+68
| | | | llvm-svn: 86213
* Teach LSR to avoid calling SplitCriticalEdge on edges with indirectbr.Dan Gohman2009-11-051-0/+1
| | | | llvm-svn: 86193
* Avoid calling getUniqueExitBlocks from within LoopSimplify, as it dependsDan Gohman2009-11-051-1/+8
| | | | | | | on loops having dedicated exits, which LoopSimplify can no longer always guarantee. llvm-svn: 86181
* LoopDeletion depends on loops having dedicated exits.Dan Gohman2009-11-051-0/+4
| | | | llvm-svn: 86180
* The introduction of indirectbr meant the introduction ofDan Gohman2009-11-051-21/+82
| | | | | | | | | 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. llvm-svn: 86176
* Update various Loop optimization passes to cope with the possibility thatDan Gohman2009-11-057-9/+29
| | | | | | LoopSimplify form may not be available. llvm-svn: 86175
* Teach LoopUnroll how to bail if LoopSimplify can't give it what it needs.Dan Gohman2009-11-051-1/+12
| | | | llvm-svn: 86164
* Call getAnalysis<LoopInfo> the normal way, instead of asking passed-inDan Gohman2009-11-051-2/+2
| | | | | | LoopPassManager for it. llvm-svn: 86163
* Delete an unused member variable.Dan Gohman2009-11-051-2/+0
| | | | llvm-svn: 86160
* Add an assertion to catch indirectbr in SplitBlockPredecessors. ThisDan Gohman2009-11-051-2/+6
| | | | | | | | | | | | makes several optimization passes abort in cases where they're currently silently miscompiling code. Remove the indirectbr assertion from SplitEdge. Indirectbr is only a problem for critical edges, and SplitEdge defers to SplitCriticalEdge to handle those, and SplitCriticalEdge has its own assertion for indirectbr. llvm-svn: 86147
* Teach SimplifyLibCalls to fold memcmp calls with constant arguments.Benjamin Kramer2009-11-051-4/+11
| | | | llvm-svn: 86141
* Do map insert+find in one step. TODO -= 2.Benjamin Kramer2009-11-051-15/+15
| | | | llvm-svn: 86133
* Update CreateMalloc so that its callers specify the size to allocate:Victor Hernandez2009-11-051-68/+74
| | | | | | | | | | | | | | | | | | 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. llvm-svn: 86077
* improve DSE when TargetData is not around, based on work byChris Lattner2009-11-042-6/+16
| | | | | | Hans Wennborg! llvm-svn: 86067
* Fix an iterator invalidation bug that happens when a hashtableChris Lattner2009-11-041-3/+4
| | | | | | resizes in IPSCCP. This fixes PR5394. llvm-svn: 86036
* move two functions up higher in the file. Delete a useless argumentChris Lattner2009-11-041-176/+232
| | | | | | | | | | | | | | 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. llvm-svn: 86021
* reimplement multiple return value handling in IPSCCP, making it Chris Lattner2009-11-031-125/+205
| | | | | | | more aggressive an correct. This survives building llvm in 64-bit mode with optimizations and the built llvm passes make check. llvm-svn: 85973
* finish half thunk thoughtChris Lattner2009-11-031-1/+3
| | | | llvm-svn: 85937
* fix an IPSCCP bug I introduced when I changed IPSCCP to start working on Chris Lattner2009-11-031-19/+31
| | | | | | | | | | functions that don't have local linkage. Basically, we need to be more careful about propagating argument information to functions whose results we aren't tracking. This fixes a miscompilation of LLVMCConfigurationEmitter.cpp when built with an llvm-gcc that has ipsccp enabled. llvm-svn: 85923
* fix a subtle bug I introduced when refactoring SCCP. TestcaseChris Lattner2009-11-031-1/+1
| | | | | | to follow. llvm-svn: 85903
* Eliminate some temporaries.Benjamin Kramer2009-11-031-22/+11
| | | | llvm-svn: 85896
* remove a isFreeCall check: it is a callinst that can write to memory already.Chris Lattner2009-11-031-3/+2
| | | | llvm-svn: 85863
* Alphabetize.Ted Kremenek2009-11-031-1/+1
| | | | llvm-svn: 85859
* turn IPSCCP back on now that the iterator invalidation bug is fixed.Chris Lattner2009-11-031-36/+50
| | | | llvm-svn: 85858
* fix a nasty iterator invalidation bug from my conversion fromChris Lattner2009-11-021-3/+2
| | | | | | std::map to DenseMap, exposed on release llvm-gcc bootstrap. llvm-svn: 85840
* revert r8579[56], which are causing unhappiness in buildbot land.Chris Lattner2009-11-021-50/+36
| | | | llvm-svn: 85818
* disable IPSCCP support for multiple return values, it is buggy, so justChris Lattner2009-11-021-1/+2
| | | | | | disable it until I can fix it. llvm-svn: 85810
* improve IPSCCP to be able to propagate the result of "!mayBeOverridden"Chris Lattner2009-11-021-36/+49
| | | | | | | | | function to calls of that function, regardless of whether it has local linkage or has its address taken. Not escaping should only affect whether we make an aggressive assumption about the arguments to a function, not whether we can track the result of it. llvm-svn: 85795
* don't mark the arguments of prototype overdefined, they will never be queried.Chris Lattner2009-11-021-3/+6
| | | | llvm-svn: 85793
* restore some code I removed in r85788, refactor it intoChris Lattner2009-11-021-4/+18
| | | | | | a shared place instead of duplicating it 4 times. llvm-svn: 85792
* remove some confused code that dates from when we hadChris Lattner2009-11-021-10/+2
| | | | | | "multiple return values" but not "first class aggregates" llvm-svn: 85791
* avoid redundant lookups in BBExecutable, and make it a SmallPtrSet.Chris Lattner2009-11-021-14/+16
| | | | llvm-svn: 85790
* Use the libanalysis 'ConstantFoldLoadFromConstPtr' functionChris Lattner2009-11-021-18/+11
| | | | | | | instead of reinventing SCCP-specific logic. This gives us new powers. llvm-svn: 85789
* switch the main 'ValueState' map from being an std::map to beingChris Lattner2009-11-021-311/+281
| | | | | | | | | | | a DenseMap. Doing this required being aware of subtle iterator invalidation issues, but it provides a big speedup. In a release-asserts build, this sped up optimizing 403.gcc from 1.34s -> 0.79s (IPSCCP) and 1.11s -> 0.44s (SCCP). This commit also conflates in a bunch of general cleanups, sorry. llvm-svn: 85788
* fix a bug exposed by moving SRoA earlier which caused a crash building kc++Chris Lattner2009-11-021-1/+6
| | | | llvm-svn: 85786
* only IPSCCP incoming arguments if the function is executable, this fixesChris Lattner2009-11-021-15/+17
| | | | | | an assertion on the buildbot. llvm-svn: 85784
OpenPOWER on IntegriCloud