Commit Graph

1329 Commits

Author SHA1 Message Date
Chris Lattner
7b550ccfc5 remove a bunch of extraneous LLVMContext arguments
from various APIs, addressing PR5325.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86231 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 04:27:31 +00:00
Dan Gohman
b1dc915a8d Avoid calling getUniqueExitBlocks from within LoopSimplify, as it depends
on loops having dedicated exits, which LoopSimplify can no longer always
guarantee.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86181 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 21:48:32 +00:00
Dan Gohman
f4e82d1f2e The introduction of indirectbr meant the introduction of
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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86176 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 21:14:46 +00:00
Dan Gohman
692ad8dd06 Teach LoopUnroll how to bail if LoopSimplify can't give it what it needs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86164 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 19:44:06 +00:00
Dan Gohman
6890584ab1 Delete an unused member variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86160 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 19:33:15 +00:00
Dan Gohman
b8eb17c807 Add an assertion to catch indirectbr in SplitBlockPredecessors. This
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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86147 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 18:25:44 +00:00
Chris Lattner
938e176633 remove a isFreeCall check: it is a callinst that can write to memory already.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85863 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03 05:33:46 +00:00
Ted Kremenek
8ab51e3041 Alphabetize.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85859 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03 04:01:53 +00:00
Chris Lattner
794c15dc71 fix a bug exposed by moving SRoA earlier which caused a crash building kc++
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85786 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-02 04:37:17 +00:00
Chris Lattner
280f3fedbf improve comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85725 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-01 18:17:37 +00:00
Chris Lattner
882029269e change llvm::MergeBlockIntoPredecessor to not merge two blocks BB1->BB2
when BB2 has its address taken.  Since it ends up doing BB2->rauw(BB1),
this can cause the address of the entry block to be taken.  Since it is
generally undesirable to nuke blocks whose address is taken, even when
we can, just unconditionally stop this xform.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85708 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-01 04:57:33 +00:00
Chris Lattner
0a4c6789d5 constant fold indirectbr(blockaddress(%bb)) -> br label %bb.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85704 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-01 03:40:38 +00:00
Chris Lattner
cdfc940912 Revert 85678/85680. The decision is to stay with the current form of
indirectbr, thus we don't need "blockaddr(@func, null)".  Eliminate it
for simplicity.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85699 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-01 01:27:45 +00:00
Chris Lattner
a4b04210d4 llvm::SplitEdge should refuse to split an edge from an indirectbr.
Fix CodeGenPrepare to not try to split edges from indirectbr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85690 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-31 22:04:43 +00:00
Chris Lattner
1b98ff3e4f update the comment above llvm::SplitCriticalEdge, and make
it abort on IndirectBrInst as describe in the comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85688 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-31 21:51:10 +00:00
Chris Lattner
c1dc35094e adjust a couple xforms to work with null bb's in BlockAddress.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85680 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-31 20:13:24 +00:00
Dan Gohman
438b583dbd Revert r85667. LoopUnroll currently can't call utility functions which
auto-update the DominatorTree because it doesn't keep the DominatorTree
current while it works.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85670 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-31 17:33:01 +00:00
Dan Gohman
dca094100b Remove redundant code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85668 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-31 16:16:41 +00:00
Dan Gohman
f230d8ad15 Merge the enhancements from LoopUnroll's FoldBlockIntoPredecessor into
MergeBlockIntoPredecessor. This makes SimplifyCFG slightly more aggressive,
and makes it unnecessary for LoopUnroll to have its own copy of this code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85667 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-31 16:08:00 +00:00
Dan Gohman
b56c966019 Simplify this code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85662 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-31 14:46:50 +00:00
Dan Gohman
13d63f2d26 Update CMakeLists for recent renames.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85660 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-31 14:38:25 +00:00
Dan Gohman
928a75f057 Rename UnrollLoop.cpp to LoopUnroll.cpp, and LoopUnroll.cpp to
LoopUnrollPass.cpp, for consistency with other passes which are
similarly split.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85659 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-31 14:37:31 +00:00
Dan Gohman
0e747beb3c Add a comment about a missed opportunity.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85635 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-30 23:15:43 +00:00
Dan Gohman
2c63566e40 Teach SimplifyCFG how to eliminate duplicate PHI nodes within a block.
This reduces codesize on a variety of codes by 1-2% on x86-64. It also
helps clean up after SSAUpdater.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85626 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-30 22:39:04 +00:00
Chris Lattner
4c0236fd8b teach various passes about blockaddress. We no longer
crash on any clang tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85465 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-29 01:21:20 +00:00
Chris Lattner
1bb95911de teach ValueMapper about BlockAddress', making bugpoint a lot more useful.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85458 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-29 00:31:02 +00:00
Chris Lattner
77488ccc63 unindent massive blocks, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85457 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-29 00:28:30 +00:00
Devang Patel
50b6e33584 Factor out redundancy from clone() implementations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85327 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-27 22:16:29 +00:00
Victor Hernandez
f006b183e2 Rename MallocFreeHelper as MemoryBuiltins
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85286 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-27 20:05:49 +00:00
Chris Lattner
c581acbbba Fix a pretty serious misfeature of the inliner: if it inlines a function
with multiple return values it inserts a PHI to merge them all together.
However, if the return values are all the same, it ends up with a pointless
PHI and this pointless PHI happens to really block SRoA from happening in 
at least a silly C++ example written by Doug, but probably others.  This 
fixes rdar://7339069.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85206 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-27 05:39:41 +00:00
Victor Hernandez
f2becca90b Rename MallocHelper as MallocFreeHelper, since it now also identifies calls to free()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85181 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 23:58:56 +00:00
Victor Hernandez
046e78ce55 Remove FreeInst.
Remove LowerAllocations pass.
Update some more passes to treate free calls just like they were treating FreeInst.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85176 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 23:43:48 +00:00
Nick Lewycky
f5a86f45e7 Remove includes of Support/Compiler.h that are no longer needed after the
VISIBILITY_HIDDEN removal.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85043 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-25 06:57:41 +00:00
Nick Lewycky
6726b6d75a Remove VISIBILITY_HIDDEN from class/struct found inside anonymous namespaces.
Chris claims we should never have visibility_hidden inside any .cpp file but
that's still not true even after this commit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85042 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-25 06:33:48 +00:00
Dan Gohman
5fa75b0fa4 MapValue doesn't needs its LLVMContext argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85020 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-24 23:37:16 +00:00
Victor Hernandez
66284e063a Auto-upgrade free instructions to calls to the builtin free function.
Update all analysis passes and transforms to treat free calls just like FreeInst.
Remove RaiseAllocations and all its tests since FreeInst no longer needs to be raised.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84987 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-24 04:23:03 +00:00
Chris Lattner
88a8624f8e alternate fix for PR5258 which avoids worklist problems, with reduced testcase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84667 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-20 20:27:49 +00:00
Torok Edwin
f993327e71 Fix PR5258, jump-threading creating invalid PHIs.
When an incoming value for a PHI is updated, we must also updated all other
incoming values for the same BB to match, otherwise we create invalid PHIs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84638 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-20 15:42:00 +00:00
Dan Gohman
841a147531 Fix SplitBlockPredecessors' LoopInfo updating code to handle the case
where a loop's header is being split and it has predecessors which are not
contained by the most-nested loop which contains the loop.
This fixes PR5235.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84505 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-19 16:04:50 +00:00
Dan Gohman
e02a698acf Change instnamer to name arguments "arg" instead of "tmp" for clarity, and
to name basic blocks "bb" instead of "BB", for consistency.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84502 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-19 14:47:32 +00:00
Chris Lattner
6128df5255 Simplify some code (first hunk) and fix PR5208 (second hunk) by
updating the callgraph when introducing a call.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84310 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 05:39:39 +00:00
Victor Hernandez
a276c603b8 Remove MallocInst from LLVM Instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84299 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 01:18:07 +00:00
Duncan Sands
ed90342d8a Strip trailing white space.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84256 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 15:20:13 +00:00
Ted Kremenek
db9d3206c0 Update CMake file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84001 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 18:48:07 +00:00
Dan Gohman
a7471de2bf Commit the removal of this file, which is now moved to lib/Analysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83999 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 18:37:20 +00:00
Dan Gohman
9b39cf5ac8 Start refactoring the inline cost estimation code so that it can be used
for purposes other than inlining.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83997 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 18:24:11 +00:00
Chris Lattner
11f15dbb28 change simplifycfg to not duplicate 'unwind' instructions. Hopefully
this will increase the likelihood of common code getting sunk towards
the unwind.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83996 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 18:13:05 +00:00
Chris Lattner
8c1db67a4c rewrite LCSSA to use SSAUpdate, to only return true if it modifies
the IR, and to implement the FIXME'd optimization.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83748 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 02:53:37 +00:00
Chris Lattner
39b0c3d613 clean up and simplify some code. Don't use setvector when things will be
inserted only once, just use vector.  Don't compute ExitBlocks unless we
need it, change std::sort to array_pod_sort.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83747 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 01:07:15 +00:00
Chris Lattner
0bef562ea2 add a simple helper method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83745 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-10 23:41:48 +00:00