1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
Commit Graph

5591 Commits

Author SHA1 Message Date
Dan Gohman
7296225414 Add a verifyAnalysis to LoopInfo, LoopSimplify, and LCSSA form that verify
that these passes are properly preserved.

Fix several transformation passes that claimed to preserve LoopSimplify
form but weren't.

llvm-svn: 80926
2009-09-03 16:31:42 +00:00
Dan Gohman
66c853f17f Change PHINode::hasConstantValue to have a DominatorTree argument
instead of a bool argument, and to do the dominator check itself.
This makes it eaiser to use when DominatorTree information is
available.

llvm-svn: 80920
2009-09-03 15:34:35 +00:00
Duncan Sands
ada22828c4 Keep track of how many memmove calls were turned into
memcpy calls.

llvm-svn: 80915
2009-09-03 13:37:16 +00:00
Andreas Neustifter
c389a5dd4a Code Cleanup.
Removed inverted flag form MaximumSpanningTree, also do not handle so much
information to MaximumSpanningTree.

llvm-svn: 80911
2009-09-03 08:52:52 +00:00
Nick Lewycky
68de201065 Remove VISIBILITY_HIDDEN from this file.
llvm-svn: 80903
2009-09-03 06:43:15 +00:00
Chris Lattner
3ac0c58031 In C++, code is not allowed to call main. In C it is, this
simplifylibcalls optimization is thus valid for C++ but not C.
It's not important enough to worry about for C++ apps, so just
remove it.

rdar://7191924

llvm-svn: 80887
2009-09-03 05:19:59 +00:00
Gabor Greif
4604e0739b back out my recent commit (r80858), it seems to break self-hosting buildbot's stage 2 configure
llvm-svn: 80871
2009-09-03 02:02:59 +00:00
Gabor Greif
68c4f27e59 re-commit r66920 (which has been backed out in r66953) I may have more luck this time. I'll back out if needed...
llvm-svn: 80858
2009-09-03 00:18:58 +00:00
Andreas Neustifter
34150f5680 Sort edges in MaximumSpanningTree more stable in case of equal weight.
(See http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090824/085890.html)

llvm-svn: 80789
2009-09-02 14:03:11 +00:00
Andreas Neustifter
1ec6affbdf Changed set of BlocksToInstrument to set of InsertedBlocks that do not have to
be instrumented.

llvm-svn: 80788
2009-09-02 13:59:05 +00:00
Andreas Neustifter
0bbffed957 Code cleanups and added comments.
llvm-svn: 80781
2009-09-02 12:38:39 +00:00
Chris Lattner
30341209de fix PR4815: some cases where DeleteDeadInstruction can delete
the instruction BBI points to.

llvm-svn: 80768
2009-09-02 06:31:02 +00:00
Chris Lattner
2cdeb25274 clean up this code a bit.
llvm-svn: 80767
2009-09-02 06:15:37 +00:00
Chris Lattner
5f54c5bd1c eliminate VISIBILITY_HIDDEN from Transforms/Scalar. PR4861
llvm-svn: 80766
2009-09-02 06:11:42 +00:00
Chris Lattner
8bb351e2c2 fix PR4837, some bugs folding vector compares. These
return a vector of i1, not i1 itself.

llvm-svn: 80761
2009-09-02 05:12:37 +00:00
Andreas Neustifter
683bc5306c OptimalEdgeProfiling: Creation of profiles.
This adds the instrumentation and runtime part of OptimalEdgeProfiling.

llvm-svn: 80712
2009-09-01 19:03:44 +00:00
Chris Lattner
ccbb87c998 remove CallGraphNode::replaceCallSite, it is redundant with other APIs.
llvm-svn: 80708
2009-09-01 18:52:39 +00:00
Chris Lattner
3d920b6bee cleanup/simplify
llvm-svn: 80706
2009-09-01 18:50:55 +00:00
Chris Lattner
e4173b39bd remove a bunch of explicit code previously needed to update the
callgraph.  This is now dead because RAUW does the job.

llvm-svn: 80703
2009-09-01 18:44:06 +00:00
Chris Lattner
2c2c37b2b1 enhance memcpy opt to turn memmoves into memcpy when the src/dest
don't alias.  Remove an old and poorly reduced testcase that fails
with this transform for reasons unrelated to the original test.

llvm-svn: 80693
2009-09-01 17:56:32 +00:00
Chris Lattner
87baaffbd2 random code cleanups, no functionality change.
llvm-svn: 80682
2009-09-01 17:09:55 +00:00
Ted Kremenek
8d7530f61e Update CMake files.
llvm-svn: 80680
2009-09-01 17:01:02 +00:00
Andreas Neustifter
64e31dbd71 Preparation for Optimal Edge Profiling:
Add statistics for regular edge profiling, this enables the comparation of the
number of edges inserted by regular and optimal edge profiling.

llvm-svn: 80668
2009-09-01 10:08:39 +00:00
Chris Lattner
53698d7fd7 Change CallGraphNode to maintain it's Function as an AssertingVH
for sanity.  This didn't turn up any bugs.

Change CallGraphNode to maintain its "callsite" information in the 
call edges list as a WeakVH instead of as an instruction*.  This fixes
a broad class of dangling pointer bugs, and makes CallGraph have a number
of useful invariants again.  This fixes the class of problem indicated
by PR4029 and PR3601.

llvm-svn: 80663
2009-09-01 06:31:31 +00:00
Chris Lattner
72a767d05f fix some cases where instcombine would change hte IR but not return true
from runOnFunction

llvm-svn: 80562
2009-08-31 06:57:37 +00:00
Chris Lattner
ca6ef3aa56 comment and simplify some code.
llvm-svn: 80540
2009-08-31 05:34:32 +00:00
Chris Lattner
09db62ac23 add -debug output
llvm-svn: 80539
2009-08-31 05:22:48 +00:00
Chris Lattner
bec75e8582 improve -debug output, so that -debug is more likely to print when
instcombine is changing stuff.

llvm-svn: 80538
2009-08-31 05:17:58 +00:00
Chris Lattner
73d1e17cec fix a bug I introduced with my 'instcombine builder' refactoring
changes: SimplifyDemandedBits can't use the builder yet because it
has the wrong insertion point.  This fixes a crash building
MultiSource/Benchmarks/PAQ8p

llvm-svn: 80537
2009-08-31 04:36:22 +00:00
Chris Lattner
b045a7f27b simplify some code by making the SCCNodes set contain Function*'s
instead of CallGraphNode*'s.  This also papers over a callgraph
problem where a pass (in this case, MemCpyOpt) introduces a new
function into the module (llvm.memset.i64) but doesn't add it to
the call graph (nor should it, since it is a function pass).

While it might be a good idea for MemCpyOpt to not synthesize 
functions in a runOnFunction(), there is no need for FunctionAttrs
to be boneheaded, so fix it there.  This fixes an assertion building
176.gcc.

llvm-svn: 80535
2009-08-31 04:09:04 +00:00
Chris Lattner
5eec095b87 Fix PR4834, a tricky case where the inliner would resolve an
indirect function pointer, inline it, then go to delete the body.
The problem is that the callgraph had other references to the function,
though the inliner had no way to know it, so we got a dangling pointer
and an invalid iterator out of the deal.

The fix to this is pretty simple: stop the inliner from deleting the
function by knowing that there are references to it.  Do this by making
CallGraphNodes contain a refcount.  This requires moving deletion of 
available_externally functions to the module-level cleanup sweep where
it belongs.

llvm-svn: 80533
2009-08-31 03:15:49 +00:00
Chris Lattner
085c521fe2 Fix some nasty callgraph dangling pointer problems in
argpromotion and structretpromote.  Basically, when replacing
a function, they used the 'changeFunction' api which changes
the entry in the function map (and steals/reuses the callgraph
node).

This has some interesting effects: first, the problem is that it doesn't
update the "callee" edges in any callees of the function in the call graph.
Second, this covers for a major problem in all the CGSCC pass stuff, which 
is that it is completely broken when functions are deleted if they *don't*
reuse a CGN.  (there is a cute little fixme about this though :).

This patch changes the protocol that CGSCC passes must obey: now the CGSCC 
pass manager copies the SCC and preincrements its iterator to avoid passes
invalidating it.  This allows CGSCC passes to mutate the current SCC.  However
multiple passes may be run on that SCC, so if passes do this, they are now
required to *update* the SCC to be current when they return.

Other less interesting parts of this patch are that it makes passes update
the CG more directly, eliminates changeFunction, and requires clients of
replaceCallSite to specify the new callee CGN if they are changing it.

llvm-svn: 80527
2009-08-31 00:19:58 +00:00
Chris Lattner
d21a94f8d6 Fix PR4748: don't fold gep(bitcast(x)) into bitcast(gep) when x
is itself a bitcast.  Since we have gep(bitcast(bitcast(y))) in this
case, just wait for the two bitcasts to get zapped.  This prevents
instcombine from confusing some aliasing stuff, and allows it to
directly eliminate the load in the testcase.

llvm-svn: 80508
2009-08-30 20:38:21 +00:00
Chris Lattner
474990915a misc cleanup
llvm-svn: 80507
2009-08-30 20:36:46 +00:00
Chris Lattner
784e8d9177 add getPointerAddressSpace() to GEP instruction, use the method
in a few scalar xforms to simplify things.

llvm-svn: 80506
2009-08-30 20:06:40 +00:00
Chris Lattner
dc6b5be632 eliminate InsertCastBefore, use the builder instead.
llvm-svn: 80505
2009-08-30 20:01:10 +00:00
Chris Lattner
2a3af9b743 eliminate InsertBitCastBefore, just use the builder instead.
llvm-svn: 80504
2009-08-30 19:47:22 +00:00
Chris Lattner
bbfe14087f convert a bunch more calls to InsertNewInstBefore to use
the new Instcombine builder.

llvm-svn: 80501
2009-08-30 18:50:58 +00:00
Chris Lattner
444e6e0118 fix typo
llvm-svn: 80500
2009-08-30 17:53:59 +00:00
Chris Lattner
dd71643cf1 give instcombine a custom IRBuilder that adds new instructions to the
workslist and is set to insert new instructions before the current one.
Convert a bunch of stuff that used to call InsertNewInstBefore over to
use it, greatly simplifying code and making it more natural.

There is still a lot more to go, but this is a good start.

llvm-svn: 80492
2009-08-30 07:44:24 +00:00
Chris Lattner
d53d314bd6 add a new InstCombineWorklist::AddValue method that works even
if the operand is not an instruction.

Simplify most uses of AddOperandsToWorkList to use AddValue and
inline it into the one remaining callsite.

llvm-svn: 80488
2009-08-30 06:27:41 +00:00
Chris Lattner
7dfc9cc68f move AddUsersToWorkList to the worklist processing class, make the
argument stronger typed.

llvm-svn: 80487
2009-08-30 06:22:51 +00:00
Chris Lattner
13202514e1 rename AddUsesToWorkList -> AddOperandsToWorkList. The
former looks too much like AddUsersToWorkList and keeps
confusing me.

Remove AddSoonDeadInstToWorklist and change its two callers
to do the same thing in a simpler way.

llvm-svn: 80486
2009-08-30 06:20:05 +00:00
Chris Lattner
1f8e8caacb inline the trivial AddToWorkList/RemoveFromWorkList methods
into their callers.  simplify ReplaceInstUsesWith.  Make
EraseInstFromFunction only add operands to the worklist if
there aren't too many of them (this was a scalability win
for crazy programs that was only infrequently enforced).
Switch more code to using EraseInstFromFunction instead of
duplicating it inline.  Change some fcmp/icmp optimizations
to modify fcmp/icmp in place instead of creating a new one
and deleting the old one just to change the predicate.

llvm-svn: 80483
2009-08-30 06:13:40 +00:00
Chris Lattner
97d6443c26 fix a bug I introduced in r80478 found by the build bot.
llvm-svn: 80482
2009-08-30 05:56:44 +00:00
Chris Lattner
ca6875bf57 refactor instcombine's worklist processing stuff out to its own class.
llvm-svn: 80481
2009-08-30 05:55:36 +00:00
Chris Lattner
741fcee014 more cleanups: remove some redundant code, and simplify some
other places.

llvm-svn: 80478
2009-08-30 05:30:55 +00:00
Chris Lattner
aecf0100db eliminate the temporary SrcGEPOperands smallvector.
llvm-svn: 80477
2009-08-30 05:08:50 +00:00
Chris Lattner
2051889d14 simplify/detangle some control flow.
llvm-svn: 80476
2009-08-30 05:00:50 +00:00
Chris Lattner
e5c5ff8f49 simplify and cleanup some code, remove some code that just
does constant folding of gep's: this is already handled in
a more general way.

No functionality change.

llvm-svn: 80475
2009-08-30 04:49:01 +00:00