Commit Graph

5911 Commits

Author SHA1 Message Date
Dan Gohman
3f9432ebca Remove an unnecessary #include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85661 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-31 14:39:43 +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
9f476e3179 Remove CodeGenLICM. It's largely obsoleted by MachineLICM's new ability
to unfold loop-invariant loads.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85657 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-31 14:35:41 +00:00
Dan Gohman
5b097014f2 Reapply r85634, with the bug fixed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85655 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-31 14:22:52 +00:00
Evan Cheng
a4006c6dbf Revert 85634. It's breaking consumer-typeset (and others).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85641 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-31 01:28:06 +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
1107c63efe Optimize around the fact that pred_iterator is slow: instead of sorting
PHI operands by the predecessor order, sort them by the order used by the
first PHI in the block. This is still suffucient to expose duplicates.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85634 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-30 23:15:21 +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
Dan Gohman
8e42e4baae Sort the incoming values in PHI nodes to match the predecessor order.
This helps expose duplicate PHIs, which will make it easier for them
to be eliminated.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85623 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-30 22:22:22 +00:00
Evan Cheng
2f192c256c Add option to createGVNPass to disable PRE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85609 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-30 20:12:24 +00:00
Nick Lewycky
abbe42e136 Apply some cleanups. No functionality changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85498 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-29 07:35:15 +00:00
Chris Lattner
b3d5a65d94 just for the hell of it, allow globalopt to statically evaluate
static constructors with indirect gotos :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85495 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-29 05:51:50 +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
Victor Hernandez
90f48e7c91 Extend getMallocArraySize() to determine the array size if the malloc argument is:
ArraySize * ElementSize
ElementSize * ArraySize
ArraySize << log2(ElementSize)
ElementSize << log2(ArraySize)

Refactor isArrayMallocHelper and delete isSafeToGetMallocArraySize, so that there is only 1 copy of the malloc array determining logic.
Update users of getMallocArraySize() to not bother calling isArrayMalloc() as well.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85421 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-28 20:18:55 +00:00
Devang Patel
cd0fee86de llvm.dbg.global_variables do not exist anymore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85402 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-28 16:51:52 +00:00
Edward O'Callaghan
c359ec7021 No newline at end of file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85390 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-28 15:04:53 +00:00
Benjamin Kramer
3185d702f2 Update CMake file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85389 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-28 13:29:18 +00:00
Owen Anderson
b62f792e78 Treat lifetime begin/end markers as allocations/frees respectively for the
purposes for GVN/DSE.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85383 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-28 07:05:35 +00:00
Nick Lewycky
40cc524ede Add ABCD, a generalized implementation of the Elimination of Array Bounds
Checks on Demand algorithm which looks at arbitrary branches instead of loop
iterations. This is GSoC work by Andre Tavares with only editorial changes
applied!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85382 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-28 07:03:15 +00:00
Chris Lattner
0eeb913aa1 Previously, all operands to Constant were themselves constant.
In the new world order, BlockAddress can have a BasicBlock operand.
This doesn't permute much, because if you have a ConstantExpr (or
anything more specific than Constant) we still know the operand has
to be a Constant.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85375 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-28 05:14:34 +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
Mike Stump
8138122a3f VS build fix, patch by Marius Wachtler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85197 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-27 02:14:13 +00:00
Eric Christopher
7b5e61707a Add objectsize intrinsic and hook it up through codegen. Doesn't
do anything than return "I don't know" at the moment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85189 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-27 00:52:25 +00:00
Dan Gohman
7f712a1987 Add braces to avoid ambiguous else.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85185 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-27 00:11:02 +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
Owen Anderson
6f55630830 Add a straight-forward implementation of SCCVN for aggressively eliminating scalar redundancies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85179 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 23:55:47 +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
Dan Gohman
06d4033a35 Simplify this code. LoopDeletion doesn't need to explicit check that
the loop exiting block dominates the latch block; if ScalarEvolution
can prove that the trip-count is finite, that's sufficient.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85165 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 22:18:58 +00:00
Dan Gohman
fe3595555a Code that checks WillNotOverflowSignedAdd before creating an Add
can safely use the NSW bit on the Add.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85164 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 22:14:22 +00:00
Ted Kremenek
7c44beaf93 Update CMake files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85161 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 22:06:01 +00:00
Dan Gohman
6000e253d4 Check in the experimental GEP splitter pass. This pass splits complex
GEPs (more than one non-zero index) into simple GEPs (at most one
non-zero index).  In some simple experiments using this it's not
uncommon to see 3% overall code size wins, because it exposes
redundancies that can be eliminated, however it's tricky to use
because instcombine aggressively undoes the work that this pass does.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85144 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 19:12:14 +00:00
Dan Gohman
440e251c75 Fix a typo in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85120 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 15:55:24 +00:00
Chris Lattner
48b59ec817 reapply r85085 with a bugfix to avoid infinite looping.
All of the 'demorgan' related xforms need to use 
dyn_castNotVal, not m_Not.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85119 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 15:40:07 +00:00
Dan Gohman
a8225083ba Make LSR's OptimizeShadowIV ignore induction variables with negative
strides for now, because it doesn't handle them correctly. This fixes a
miscompile of SingleSource/Benchmarks/Misc-C++/ray.

This problem was usually hidden because indvars transforms such induction
variables into negations of canonical induction variables.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85118 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 15:32:57 +00:00
Evan Cheng
85def16079 Revert 85085. It causes infinite looping during llvm-gcc build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85090 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 03:51:32 +00:00
Chris Lattner
863928fc39 Implement PR3266 & PR5276, folding:
not (or (icmp, icmp)) -> and(icmp, icmp)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85085 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 01:06:31 +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
Nick Lewycky
4a134afaef Remove ICmpInst::isSignedPredicate which was a reimplementation
CmpInst::isSigned.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85037 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-25 05:20:17 +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
Dan Gohman
32663b719b Rename isLoopExit to isLoopExiting, for consistency with the wording
used elsewhere - an exit block is a block outside the loop branched to
from within the loop. An exiting block is a block inside the loop that
branches out.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85019 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-24 23:34:26 +00:00
Dan Gohman
e6e37b94e8 Rewrite LoopRotation's SSA updating code using SSAUpdater.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85016 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-24 23:19:52 +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
Victor Hernandez
7b929dad59 Remove AllocationInst. Since MallocInst went away, AllocaInst is the only subclass of AllocationInst, so it no longer is necessary.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84969 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-23 21:09:37 +00:00
Dan Gohman
934af9cfe0 Make LoopDeletion check the maximum backedge taken count, rather than the
exact backedge taken count, when checking for infinite loops. This allows
it to delete loops with multiple exit conditions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84952 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-23 17:10:01 +00:00
Chris Lattner
e00c43fc35 move another load optimization from instcombine -> libanalysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84841 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 06:44:07 +00:00
Chris Lattner
62d327e241 move 'loading i32 from string' optimization from instcombine
to libanalysis.  Instcombine shrinking... does this even 
make sense???


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84840 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 06:38:35 +00:00
Chris Lattner
878e494670 Move some constant folding logic for loads out of instcombine into
Analysis/ConstantFolding.cpp.  This doesn't change the behavior of
instcombine but makes other clients of ConstantFoldInstruction
able to handle loads.  This was partially extracted from Eli's patch
in PR3152.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84836 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 06:25:11 +00:00
Chris Lattner
7f23958aa4 fix PR5262.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84810 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 00:17:26 +00:00
Devang Patel
49708ad993 Derive metadata hierarchy from Value instead of User.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84801 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-21 23:57:35 +00:00
Chris Lattner
857eb5793e revert r84754, it isn't the right approach. Edwin, please propose
patches for fixes like this instead of committing them directly.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84799 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-21 23:41:58 +00:00
Victor Hernandez
68afa54033 Make changes to rev 84292 as requested by Chris Lattner.
Most changes are cleanup, but there is 1 correctness fix:
I fixed InstCombine so that the icmp is removed only if the malloc call is removed (which requires explicit removal because the Worklist won't DCE any calls since they can have side-effects).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84772 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-21 19:11:40 +00:00
Torok Edwin
0739bd0ab2 Fix PR5262: when folding select into PHI, make sure all operands are available
in the PHI's Basic Block. This uses a conservative approach, because we don't
have dominator info in instcombine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84754 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-21 10:49:00 +00:00
Chris Lattner
a52fce49eb make GVN work better when TD is not around:
"In the existing code, if the load and the value to replace it with are
of different types *and* target data is available, it tries to use the
target data to coerce the replacement value to the type of the load.
Otherwise, it skips all effort to handle the type mismatch and just
feeds the wrongly-typed replacement value to replaceAllUsesWith, which
triggers an assertion.

The patch replaces it with an outer if checking for type mismatch, and
an inner if-else that checks whether target data is available and, if
not, returns false rather than trying to replace the load."

Patch by Kenneth Uildriks!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84739 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-21 04:11:19 +00:00
Devang Patel
08e4339310 Do not remove dead metadata for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84731 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-21 02:21:34 +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
Dan Gohman
cd53f64367 Restore LoopUnswitch's block-oriented threshold. LoopUnswitch now checks both
the estimated code size and the number of blocks when deciding whether to
do a non-trivial unswitch. This protects it from some very undesirable
worst-case behavior on large numbers of loop-unswitchable conditions, such
as in the testcase in PR5259.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84661 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-20 20:06:09 +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
Torok Edwin
2b6183d254 Fix PR4313: IPSCCP was not setting the lattice value for the invoke instruction
when the invoke had multiple return values: it set the lattice value only on the
extractvalue.
This caused the invoke's lattice value to remain the default (undefined), and
later propagated to extractvalue's operand, which incorrectly introduces
undefined behavior.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84637 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-20 15:15:09 +00:00
Owen Anderson
d41ed4e2c4 Refactor lookup_or_add to contain _MUCH_ less duplicated code. Add support for
numbering first class aggregate instructions while we're at it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84547 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-19 22:14:22 +00:00
Victor Hernandez
93bb60d379 Malloc calls are marked NoAlias, so the code below the isMalloc() check makes it redundant. Removing the isMalloc() check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84541 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-19 21:47:22 +00:00
Owen Anderson
158d86e5b0 Simplify some code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84533 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-19 21:14:57 +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
98b532cf33 remove the IndMemRemPass, which only made sense for when malloc/free were intrinsic
instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84404 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 05:02:09 +00:00
Daniel Dunbar
3446cf142e Use raw_ostream::write_escaped instead of EscapeString.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84356 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 20:43:19 +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
Victor Hernandez
13ad5aaaff Autoupgrade malloc insts to malloc calls.
Update testcases that rely on malloc insts being present.

Also prematurely remove MallocInst handling from IndMemRemoval and RaiseAllocations to help pass tests in this incremental step.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84292 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 00:00:19 +00:00
Victor Hernandez
8db42d2b1c HeapAllocSRoA also needs to check if malloc array size can be computed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84288 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 23:12:25 +00:00
Dan Gohman
b00f236b03 Move zext and sext casts fed by loads into the same block as the
load, to help SelectionDAG fold them into the loads, unless
conditions are unfavorable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84271 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 20:59:35 +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
Victor Hernandez
2491ce0353 Fix bug where array malloc with unexpected computation of the size argument resulted in MallocHelper
identifying the malloc as a non-array malloc.  This broke GlobalOpt's optimization of stores of mallocs 
to global variables.

The fix is to classify malloc's into 3 categories:
1. non-array mallocs
2. array mallocs whose array size can be determined
3. mallocs that cannot be determined to be of type 1 or 2 and cannot be optimized

getMallocArraySize() returns NULL for category 3, and all users of this function must avoid their 
malloc optimization if this function returns NULL.

Eventually, currently unexpected codegen for computing the malloc's size argument will be supported in
isArrayMalloc() and getMallocArraySize(), extending malloc optimizations to those examples.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84199 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-15 20:14:52 +00:00
Chris Lattner
2ee743b53b only try to fold constantexpr operands when the worklist is first populated,
don't bother every time going around the main worklist.  This speeds up a 
release-asserts opt -std-compile-opts on 403.gcc by about 4% (1.5s).  It
seems to speed up the most expensive instances of instcombine by ~10%.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84171 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-15 04:59:28 +00:00
Chris Lattner
e2cc1ad230 don't bother calling ConstantFoldInstruction unless there is a use of the
instruction (which disqualifies stores, unreachable, etc) and at least the
first operand is a constant.  This filters out a lot of obvious cases that
can't be folded.  Also, switch the IRBuilder to a TargetFolder, which tries
harder.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84170 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-15 04:13:44 +00:00
Devang Patel
9674d15120 Use isVoidTy()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84118 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 17:29:00 +00:00
Chris Lattner
8db2cd1fc7 make instcombine's instruction sinking more aggressive in the
presence of PHI nodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84103 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 15:21:58 +00:00
Devang Patel
228ebd0f4c Check void type before using RAUWd.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84049 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 22:56:32 +00:00
Devang Patel
1bf5ebc7be Do not check use_empty() before replaceAllUsesWith(). This gives ValueHandles a chance to get properly updated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84033 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 21:41:20 +00:00
Dan Gohman
597c5e2d32 Use the new CodeMetrics class to compute code size instead of
manually counting instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84016 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 20:12:23 +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
e4aeec003f Move the InlineCost code from Transforms/Utils to Analysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83998 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 18:30:07 +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
Dan Gohman
b24f6c7495 Make LoopUnswitch's cost estimation count Instructions, rather than
BasicBlocks, so that it doesn't blindly procede in the presence of
large individual BasicBlocks. This addresses a class of code-size
expansion problems.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83992 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 17:50:43 +00:00
Evan Cheng
67d1d1f832 Make licm debug message readable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83908 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-12 22:25:23 +00:00
Dale Johannesen
c1deda50ca Fix warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83870 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-12 18:45:32 +00:00
Chris Lattner
67f7d549db populate instcombine's initial worklist more carefully, causing
it to visit instructions from the start of the function to the
end of the function in the first path.  This greatly speeds up
some pathological cases (e.g. PR5150).

Try #3, this time with some unneeded debug info stuff removed
which was causing dead pointers to be added to the worklist.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83818 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-12 03:58:40 +00:00
Chris Lattner
b152a87b10 revert r83814 for now, it is making the llvm-gcc bootstrap unhappy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83817 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 23:56:08 +00:00
Chris Lattner
6d0111f6c7 populate instcombine's initial worklist more carefully, causing
it to visit instructions from the start of the function to the
end of the function in the first path.  This greatly speeds up
some pathological cases (e.g. PR5150). 



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83814 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 23:17:43 +00:00
Chris Lattner
2ad8cf5555 remove some harmful code that would turn an insertelement on an undef
into a shuffle even if it was used by another insertelement.  If the
visitation order of instcombine was wrong, this would turn a chain of
insertelements into a chain of shufflevectors, which was quite painful.

Since CollectShuffleElements handles these cases, the code can just
be nuked.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83810 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 23:02:46 +00:00
Chris Lattner
d088314998 teach instcombine to simplify xor's harder, catching the
new testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83799 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 22:22:13 +00:00
Chris Lattner
7acdf1de06 cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83797 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 22:00:32 +00:00
Chris Lattner
a249847008 cleanup, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83795 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 21:36:10 +00:00
Chris Lattner
d2c58366d8 generalize a transformation even more: we don't care whether the
input the the mul is a zext from bool, just that it is all zeros
other than the low bit.  This fixes some phase ordering issues
that would cause us to miss some xforms in mul.ll when the worklist
is visited differently.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83794 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 21:29:45 +00:00
Chris Lattner
0036e3a469 simplify a transformation by making it more general.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83792 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 21:22:21 +00:00
Chris Lattner
61488a3310 temporarily revert previous patch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83791 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 21:05:34 +00:00
Chris Lattner
9a12a786b0 populate instcombine's initial worklist more carefully, causing
it to visit instructions from the start of the function to the
end of the function in the first path.  This greatly speeds up
some pathological cases (e.g. PR5150). 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83790 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 21:04:37 +00:00
Torok Edwin
849a639e17 Remove CleanupDbgInfo, instcombine does this and its not worth duplicating it
here.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83789 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 19:58:35 +00:00
Torok Edwin
9289ae85b4 LICM shouldn't sink/delete debug information. Fix this and add a testcase.
For now the metadata of sinked/hoisted instructions is still wrong, but that'll
be fixed when instructions will have debug metadata directly attached.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83786 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 19:15:54 +00:00
Chris Lattner
5a06cf644f when folding duplicate conditions, delete the
now-probably-dead instruction tree feeding it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83778 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 18:39:58 +00:00
Chris Lattner
8af304ab3b implement rdar://7293527, a trivial instcombine that llvm-gcc
gets but clang doesn't, because it is implemented in GCC's
fold routine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83761 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 07:53:15 +00:00
Chris Lattner
78c552ef30 implement a transformation in jump threading that is currently
done by condprop, but do it in a much more general form.  The
basic idea is that we can do a limited form of tail duplication
in the case when we have a branch on a phi.  Moving the branch
up in to the predecessor block makes instruction selection
much easier and encourages chained jump threadings.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83759 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 07:24:57 +00:00
Chris Lattner
6b65f47ad5 restructure some code, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83756 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 04:40:21 +00:00
Chris Lattner
bdbf1a177d factor some code better and move a function, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83755 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 04:33:43 +00:00
Chris Lattner
e33583b7c2 make jump threading on a phi with undef inputs happen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83754 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 04:18:15 +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
a09fbf0af0 switch GVN to use SSAUpdater. Besides removing a lot of complexity
from GVN, this also speeds it up, inserts fewer PHI nodes (see the
testcase) and allows it to remove more loads (due to fewer PHI nodes
standing in the way).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83746 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-10 23:50:30 +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
Chris Lattner
f5a1fb6b24 add ability for clients of SSAUpdater to find out about the
PHI nodes inserted.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83744 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-10 23:15:24 +00:00
Chris Lattner
813dbd5912 remove dead code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83742 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-10 23:04:12 +00:00
Chris Lattner
1a8d4de397 add the ability to get a rewritten value from the middle of a block,
not just at the end.  Add a big comment explaining when this could
be useful (which never happens for jump threading).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83741 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-10 23:00:11 +00:00
Chris Lattner
5fb107287f rename GetValueInBlock -> GetValueAtEndOfBlock to better reflect
what it does.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83740 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-10 22:41:58 +00:00
Chris Lattner
f9920fabac use a typedef instead of spelling out an insane type. Yay for auto someday.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83707 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-10 09:09:20 +00:00
Chris Lattner
433a0dbb26 Change jump threading to use the new SSAUpdater class instead of
DemoteRegToStack.  This makes it more efficient (because it isn't
creating a ton of load/stores that are eventually removed by a later
mem2reg), and more slightly more effective (because those load/stores
don't get in the way of threading).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83706 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-10 09:05:58 +00:00
Chris Lattner
93f3bcf7f3 Implement an efficient and fully general SSA update mechanism that
works on unstructured CFGs.  This implements PR217, our oldest open PR.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83705 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-10 09:04:27 +00:00
Chris Lattner
2d7f1d24bf random tidying
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83701 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-10 06:22:45 +00:00
Dale Johannesen
bdb984bc27 Use names instead of numbers for some of the magic
constants used in inlining heuristics (especially
those used in more than one file).  No functional change.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83675 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-09 21:42:02 +00:00
Dale Johannesen
e91b9a3b59 When considering whether to inline Callee into Caller,
and that will make Caller too big to inline, see if it
might be better to inline Caller into its callers instead.
This situation is described in PR 2973, although I haven't
tried the specific case in SPASS.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83602 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-09 00:11:32 +00:00
Dan Gohman
8a261e44f7 Add a form of addPreserved which takes a string argument, to allow passes
to declare that they preserve other passes without needing to pull in
additional header file or library dependencies. Convert MachineFunctionPass
and CodeGenLICM to make use of this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83555 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-08 17:00:02 +00:00
Jeffrey Yasskin
4306963170 In instcombine's debug output, avoid printing ADD for instructions that are
already on the worklist, and print Visited when an instruction is about to be
visited.  Net, on one input, this reduced the output size by at least 9x.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83510 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-08 00:12:24 +00:00
Eric Christopher
37c8b86d43 80-column and whitespace fixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83489 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-07 21:14:25 +00:00
Eric Christopher
00d67db384 Add FreeInst to the "is a call" check for Insts that are calls, but
not intrinsics.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83441 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-07 00:54:08 +00:00
Eric Christopher
0704300d88 While we still have a MallocInst treat it as a call like any other
for inlining.

When MallocInst goes away this code will be subsumed as part of
calls and work just fine...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83434 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-07 00:02:18 +00:00
Ted Kremenek
3351085d84 Update CMake file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83404 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-06 19:45:38 +00:00
Chris Lattner
7963e15951 remove predicate simplifier, it never got the last bugs beaten
out of it, and jump threading, condprop and gvn are now getting
most of the benefit.  This was approved by Nicholas and Nicolas.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83390 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-06 16:59:46 +00:00
Duncan Sands
ac53a0b272 Introduce and use convenience methods for getting pointer types
where the element is of a basic builtin type.  For example, to get
an i8* use getInt8PtrTy.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83379 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-06 15:40:36 +00:00
Dan Gohman
c6f69e94fa Remove an unnnecessary LLVMContext argument in
ConstantFoldLoadThroughGEPConstantExpr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83311 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-05 16:36:26 +00:00
Dan Gohman
e41a115e6a Use Use::operator= instead of Use::set, for consistency.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83310 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-05 16:31:55 +00:00
Chris Lattner
cf0fe8d813 strength reduce a ton of type equality tests to check the typeid (Through
the new predicates I added) instead of going through a context and doing a
pointer comparison.  Besides being cheaper, this allows a smart compiler
to turn the if sequence into a switch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83297 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-05 05:54:46 +00:00
Chris Lattner
bbc33853a5 instcombine shouldn't delete all null checks for mallocs.
This fixes PR5130.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83290 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-05 02:47:47 +00:00
Owen Anderson
08993acada Do away with the strange use of BitVectors in SSI, and just use normal sets. This makes the code much more C++/LLVM-ish.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83286 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-04 18:49:55 +00:00
Owen Anderson
216abab84f Fix a typo in the comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83283 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-04 17:52:13 +00:00
Owen Anderson
7aa3c781b4 SSI needs to require DT and DF transitively, since it uses them outside of its runOnFunction.
Similarly, it can be marked setPreservesAll, since it does no work in its runOnFunction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83282 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-04 17:47:39 +00:00
Evan Cheng
a0479e5332 Allow -inline-threshold override default threshold even if compiling to optimize for size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83274 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-04 06:13:54 +00:00
Douglas Gregor
8f3ec31133 Remove GVNPRE.cpp from the CMake makefile
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83194 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-01 05:30:05 +00:00
Chris Lattner
99be299edb remove the GVNPRE pass. It has been subsumed by the GVN pass.
Ok'd by Owen.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83193 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-01 02:18:36 +00:00
Dan Gohman
5184635eda Fix this code so that it doesn't try to iterate through a std::vector
while calling changeImmediateDominator, which removes elements from the
vector. This fixes PR5097.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83166 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-30 20:54:16 +00:00
Dan Gohman
2d5dfd94e5 Remove a redundant #ifndef and add an assertion string.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82991 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-28 14:38:19 +00:00
Dan Gohman
d84db11333 Convert LoopSimplify and LoopExtractor from FunctionPass to LoopPass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82990 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-28 14:37:51 +00:00
Chris Lattner
3ddfb21306 The select instruction is not neccesarily in the same block as the
phi nodes.  Make sure to phi translate from the right block. 

This fixes a llvm-building-llvm failure on GVN-PRE.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82970 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-28 06:49:44 +00:00
Chris Lattner
9b1de95593 simplify some code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82936 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 21:46:50 +00:00
Chris Lattner
42ebefae8e The bitcast case is not needed here: instcombine turns icmp(bitcast(x), null) -> icmp(x, null) already.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82935 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 21:42:46 +00:00