Commit Graph

5583 Commits

Author SHA1 Message Date
Nick Lewycky
8aa9fba7cb Remove VISIBILITY_HIDDEN from this file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80903 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 06:43:15 +00:00
Chris Lattner
e9f9a7e10e 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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80887 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 05:19:59 +00:00
Gabor Greif
03a5f139fb back out my recent commit (r80858), it seems to break self-hosting buildbot's stage 2 configure
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80871 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 02:02:59 +00:00
Gabor Greif
190390b8d3 re-commit r66920 (which has been backed out in r66953) I may have more luck this time. I'll back out if needed...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80858 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 00:18:58 +00:00
Andreas Neustifter
2252d481d6 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)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80789 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 14:03:11 +00:00
Andreas Neustifter
8f123b85c6 Changed set of BlocksToInstrument to set of InsertedBlocks that do not have to
be instrumented.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80788 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 13:59:05 +00:00
Andreas Neustifter
9341cdc217 Code cleanups and added comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80781 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 12:38:39 +00:00
Chris Lattner
40ef630a46 fix PR4815: some cases where DeleteDeadInstruction can delete
the instruction BBI points to.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80768 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 06:31:02 +00:00
Chris Lattner
20a2faa980 clean up this code a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80767 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 06:15:37 +00:00
Chris Lattner
3e8b6631e6 eliminate VISIBILITY_HIDDEN from Transforms/Scalar. PR4861
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80766 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 06:11:42 +00:00
Chris Lattner
9e17b632ec fix PR4837, some bugs folding vector compares. These
return a vector of i1, not i1 itself.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80761 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 05:12:37 +00:00
Andreas Neustifter
f771dae69a OptimalEdgeProfiling: Creation of profiles.
This adds the instrumentation and runtime part of OptimalEdgeProfiling.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80712 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-01 19:03:44 +00:00
Chris Lattner
da230cb876 remove CallGraphNode::replaceCallSite, it is redundant with other APIs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80708 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-01 18:52:39 +00:00
Chris Lattner
7c8c1ba40c cleanup/simplify
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80706 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-01 18:50:55 +00:00
Chris Lattner
81dfb38852 remove a bunch of explicit code previously needed to update the
callgraph.  This is now dead because RAUW does the job.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80703 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-01 18:44:06 +00:00
Chris Lattner
f41eaacee4 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80693 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-01 17:56:32 +00:00
Chris Lattner
61c6ba8571 random code cleanups, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80682 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-01 17:09:55 +00:00
Ted Kremenek
eed51b04e3 Update CMake files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80680 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-01 17:01:02 +00:00
Andreas Neustifter
62353a8d13 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80668 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-01 10:08:39 +00:00
Chris Lattner
a541b0fde2 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80663 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-01 06:31:31 +00:00
Chris Lattner
b0b822c449 fix some cases where instcombine would change hte IR but not return true
from runOnFunction


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80562 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 06:57:37 +00:00
Chris Lattner
d43d5e832f comment and simplify some code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80540 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 05:34:32 +00:00
Chris Lattner
a3512bd589 add -debug output
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80539 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 05:22:48 +00:00
Chris Lattner
931f8f3d12 improve -debug output, so that -debug is more likely to print when
instcombine is changing stuff.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80538 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 05:17:58 +00:00
Chris Lattner
95afdfee82 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80537 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 04:36:22 +00:00
Chris Lattner
98a27ce03f 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80535 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 04:09:04 +00:00
Chris Lattner
b374b90e81 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80533 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 03:15:49 +00:00
Chris Lattner
5095e3d1d1 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80527 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 00:19:58 +00:00
Chris Lattner
2de2319124 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80508 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 20:38:21 +00:00
Chris Lattner
963f4ba826 misc cleanup
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80507 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 20:36:46 +00:00
Chris Lattner
8a67ac525e add getPointerAddressSpace() to GEP instruction, use the method
in a few scalar xforms to simplify things.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80506 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 20:06:40 +00:00
Chris Lattner
2345d1d22e eliminate InsertCastBefore, use the builder instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80505 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 20:01:10 +00:00
Chris Lattner
08142f2560 eliminate InsertBitCastBefore, just use the builder instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80504 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 19:47:22 +00:00
Chris Lattner
f925cbd7e4 convert a bunch more calls to InsertNewInstBefore to use
the new Instcombine builder.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80501 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 18:50:58 +00:00
Chris Lattner
75551f748d fix typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80500 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 17:53:59 +00:00
Chris Lattner
7438106207 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80492 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 07:44:24 +00:00
Chris Lattner
3c4e38e411 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80488 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 06:27:41 +00:00
Chris Lattner
e5ecdb5a98 move AddUsersToWorkList to the worklist processing class, make the
argument stronger typed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80487 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 06:22:51 +00:00
Chris Lattner
c3a3e3682b 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80486 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 06:20:05 +00:00
Chris Lattner
7a1e924b9a 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80483 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 06:13:40 +00:00
Chris Lattner
878daed2aa fix a bug I introduced in r80478 found by the build bot.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80482 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 05:56:44 +00:00
Chris Lattner
873ff0158e refactor instcombine's worklist processing stuff out to its own class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80481 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 05:55:36 +00:00
Chris Lattner
ab984847a8 more cleanups: remove some redundant code, and simplify some
other places.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80478 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 05:30:55 +00:00
Chris Lattner
f9b91bb5ef eliminate the temporary SrcGEPOperands smallvector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80477 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 05:08:50 +00:00
Chris Lattner
6e24d83167 simplify/detangle some control flow.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80476 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 05:00:50 +00:00
Chris Lattner
ccf4b34a08 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80475 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 04:49:01 +00:00
Dan Gohman
14ef4f0a4c Remove an unnecessary Context argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80454 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-29 23:39:38 +00:00
Benjamin Kramer
ac6f73a2e7 Inline empty destructor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80431 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-29 13:38:21 +00:00
Bill Wendling
d1e1d39b85 Fix warning about non-virtual destructor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80429 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-29 12:31:38 +00:00
Devang Patel
e4b275610a Reapply 79977.
Use MDNodes to encode debug info in llvm IR.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80406 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 23:24:31 +00:00