1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00
Commit Graph

1221 Commits

Author SHA1 Message Date
Chris Lattner
422a3ff7d5 add an assert to make it really clear what this is doing. Return singularval as
a compile time perf optimization to avoid a load.

llvm-svn: 90507
2009-12-04 01:03:32 +00:00
Chris Lattner
9ce833945e improve portability to avoid conflicting with std::next in c++'0x.
Patch by Howard Hinnant!

llvm-svn: 90365
2009-12-03 00:50:42 +00:00
Jim Grosbach
ccb304105a Move EliminateDuplicatePHINodes() from SimplifyCFG.cpp to Local.cpp
llvm-svn: 90324
2009-12-02 17:06:45 +00:00
Nick Lewycky
b3bedf4b2d Pull LLVMContext out of PromoteMemToReg.
llvm-svn: 89645
2009-11-23 03:50:44 +00:00
Dan Gohman
d115107ef2 Make Loop::getLoopLatch() work on loops which don't have preheaders, as
it may be used in contexts where preheader insertion may have failed due
to an indirectbr.

Make LoopSimplify's LoopSimplify::SeparateNestedLoop properly fail in
the case that it would require splitting an indirectbr edge.

These fix PR5502.

llvm-svn: 89484
2009-11-20 20:51:18 +00:00
Jim Grosbach
f5f954f888 Eliminate duplicate phi nodes in loops. Loop rotation, for example, can introduce these, and it's beneficial to later passes to clean them up.
llvm-svn: 89298
2009-11-19 02:03:18 +00:00
Jim Grosbach
5787c6eb88 Make EliminateDuplicatePHINodes() available as a utility function
llvm-svn: 89297
2009-11-19 02:02:10 +00:00
Daniel Dunbar
e01ea92e28 Add the braces gcc suggested.
llvm-svn: 86933
2009-11-12 02:52:56 +00:00
Duncan Sands
f0d9823d0b Don't trivially delete unused calls to llvm.invariant.start. This allows
llvm.invariant.start to be used without necessarily being paired with a call
to llvm.invariant.end.  If you run the entire optimization pipeline then such
calls are in fact deleted (adce does it), but that's actually a good thing since
we probably do want them to be zapped late in the game.  There should really be
an integration test that checks that the llvm.invariant.start call lasts long
enough that all passes that do interesting things with it get to do their stuff
before it is deleted.  But since no passes do anything interesting with it yet
this will have to wait for later.

llvm-svn: 86840
2009-11-11 15:34:13 +00:00
Devang Patel
5c983cb2ab Implement support to debug inlined functions.
llvm-svn: 86748
2009-11-10 23:06:00 +00:00
Chris Lattner
ec4264fbb0 move some generally useful functions out of jump threading
into libanalysis and transformutils.

llvm-svn: 86735
2009-11-10 22:26:15 +00:00
Chris Lattner
9428f34d89 refactor TryToSimplifyUncondBranchFromEmptyBlock out of SimplifyCFG.
llvm-svn: 86666
2009-11-10 05:59:26 +00:00
Chris Lattner
131172dc76 fix ConstantFoldCompareInstOperands to take the LHS/RHS as
individual operands instead of taking a temporary array

llvm-svn: 86619
2009-11-09 23:06:58 +00:00
Dan Gohman
7010cad26a Fix a comment in a typo that Duncan noticed.
llvm-svn: 86575
2009-11-09 18:59:22 +00:00
Dan Gohman
457b8bad4e Generalize LCSSA to handle loops with exits with predecessors outside
the loop. This is needed because with indirectbr it may not be possible
for LoopSimplify to guarantee that all loop exit predecessors are
inside the loop. This fixes PR5437.

LCCSA no longer actually requires LoopSimplify form, but for now it
must still have the dependency because the PassManager doesn't know
how to schedule LoopSimplify otherwise.

llvm-svn: 86569
2009-11-09 18:28:24 +00:00
Chris Lattner
903ae55e1c remove a bunch of extraneous LLVMContext arguments
from various APIs, addressing PR5325.

llvm-svn: 86231
2009-11-06 04:27:31 +00:00
Dan Gohman
e93b2dbc0f Avoid calling getUniqueExitBlocks from within LoopSimplify, as it depends
on loops having dedicated exits, which LoopSimplify can no longer always
guarantee.

llvm-svn: 86181
2009-11-05 21:48:32 +00:00
Dan Gohman
f65735f0c5 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.

llvm-svn: 86176
2009-11-05 21:14:46 +00:00
Dan Gohman
cf44615b89 Teach LoopUnroll how to bail if LoopSimplify can't give it what it needs.
llvm-svn: 86164
2009-11-05 19:44:06 +00:00
Dan Gohman
a25cd27300 Delete an unused member variable.
llvm-svn: 86160
2009-11-05 19:33:15 +00:00
Dan Gohman
7e9c38c364 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.

llvm-svn: 86147
2009-11-05 18:25:44 +00:00
Chris Lattner
9d0f925cf0 remove a isFreeCall check: it is a callinst that can write to memory already.
llvm-svn: 85863
2009-11-03 05:33:46 +00:00
Ted Kremenek
cd7ab8bfa0 Alphabetize.
llvm-svn: 85859
2009-11-03 04:01:53 +00:00
Chris Lattner
9fc809ca55 fix a bug exposed by moving SRoA earlier which caused a crash building kc++
llvm-svn: 85786
2009-11-02 04:37:17 +00:00
Chris Lattner
02e43b65d1 improve comment.
llvm-svn: 85725
2009-11-01 18:17:37 +00:00
Chris Lattner
c340ce422d 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.

llvm-svn: 85708
2009-11-01 04:57:33 +00:00
Chris Lattner
e7dc33941b constant fold indirectbr(blockaddress(%bb)) -> br label %bb.
llvm-svn: 85704
2009-11-01 03:40:38 +00:00
Chris Lattner
2bbe57b2b8 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.

llvm-svn: 85699
2009-11-01 01:27:45 +00:00
Chris Lattner
43591a021a llvm::SplitEdge should refuse to split an edge from an indirectbr.
Fix CodeGenPrepare to not try to split edges from indirectbr.

llvm-svn: 85690
2009-10-31 22:04:43 +00:00
Chris Lattner
ea1bebaa65 update the comment above llvm::SplitCriticalEdge, and make
it abort on IndirectBrInst as describe in the comment.

llvm-svn: 85688
2009-10-31 21:51:10 +00:00
Chris Lattner
48de74645e adjust a couple xforms to work with null bb's in BlockAddress.
llvm-svn: 85680
2009-10-31 20:13:24 +00:00
Dan Gohman
61e806613f 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.

llvm-svn: 85670
2009-10-31 17:33:01 +00:00
Dan Gohman
cb32fa9e90 Remove redundant code.
llvm-svn: 85668
2009-10-31 16:16:41 +00:00
Dan Gohman
40cec16be1 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.

llvm-svn: 85667
2009-10-31 16:08:00 +00:00
Dan Gohman
14d0be4693 Simplify this code.
llvm-svn: 85662
2009-10-31 14:46:50 +00:00
Dan Gohman
793119ef88 Update CMakeLists for recent renames.
llvm-svn: 85660
2009-10-31 14:38:25 +00:00
Dan Gohman
0186fd092a Rename UnrollLoop.cpp to LoopUnroll.cpp, and LoopUnroll.cpp to
LoopUnrollPass.cpp, for consistency with other passes which are
similarly split.

llvm-svn: 85659
2009-10-31 14:37:31 +00:00
Dan Gohman
c8a5a5ece2 Add a comment about a missed opportunity.
llvm-svn: 85635
2009-10-30 23:15:43 +00:00
Dan Gohman
48f3169c77 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.

llvm-svn: 85626
2009-10-30 22:39:04 +00:00
Chris Lattner
a0e35cae82 teach various passes about blockaddress. We no longer
crash on any clang tests.

llvm-svn: 85465
2009-10-29 01:21:20 +00:00
Chris Lattner
0a782eec94 teach ValueMapper about BlockAddress', making bugpoint a lot more useful.
llvm-svn: 85458
2009-10-29 00:31:02 +00:00
Chris Lattner
8f70e602d3 unindent massive blocks, no functionality change.
llvm-svn: 85457
2009-10-29 00:28:30 +00:00
Devang Patel
b7572e3783 Factor out redundancy from clone() implementations.
llvm-svn: 85327
2009-10-27 22:16:29 +00:00
Victor Hernandez
0f662a7acf Rename MallocFreeHelper as MemoryBuiltins
llvm-svn: 85286
2009-10-27 20:05:49 +00:00
Chris Lattner
aecb9a4040 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.

llvm-svn: 85206
2009-10-27 05:39:41 +00:00
Victor Hernandez
6c86b93663 Rename MallocHelper as MallocFreeHelper, since it now also identifies calls to free()
llvm-svn: 85181
2009-10-26 23:58:56 +00:00
Victor Hernandez
673c036bc7 Remove FreeInst.
Remove LowerAllocations pass.
Update some more passes to treate free calls just like they were treating FreeInst.

llvm-svn: 85176
2009-10-26 23:43:48 +00:00
Nick Lewycky
2b8400628d Remove includes of Support/Compiler.h that are no longer needed after the
VISIBILITY_HIDDEN removal.

llvm-svn: 85043
2009-10-25 06:57:41 +00:00
Nick Lewycky
711c726c97 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.

llvm-svn: 85042
2009-10-25 06:33:48 +00:00
Dan Gohman
07044648b2 MapValue doesn't needs its LLVMContext argument.
llvm-svn: 85020
2009-10-24 23:37:16 +00:00