Commit Graph

5686 Commits

Author SHA1 Message Date
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
Chris Lattner
06e4052699 calls are already unmovable, malloc doesn't need a special case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82933 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 21:36:19 +00:00
Chris Lattner
32c0d2255f calls to external functions are already marked overdefined, special casing
malloc isn't needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82932 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 21:35:11 +00:00
Chris Lattner
4412d04876 calls are already handled, malloc doesn't need a special case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82931 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 21:33:46 +00:00
Chris Lattner
68b1bbbc55 calls are rejected above, no need to special case malloc here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82929 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 21:31:39 +00:00
Chris Lattner
439044f4f9 remove special handling of bitcast(malloc), it will be handled
when the loop inspects the bitcast operand.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82928 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 21:29:28 +00:00
Chris Lattner
2a9325ff2f unlike the malloc instruction, "malloc" calls do not claim to be readonly, just nounwind.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82927 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 21:23:38 +00:00
Chris Lattner
213cd61fa7 allow pushing icmps through phis with multiple uses and across critical edges.
These are important to push up to encourage jump threading.  This shrinks 176.gcc a bit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82923 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 20:46:36 +00:00
Chris Lattner
c6df8f4d5f Enhance the previous fix for PR4895 to allow more values than just
simple constants for the true/false value of the select.  We now
do phi translation etc.  This really fixes PR4895 :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82917 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 20:18:49 +00:00
Chris Lattner
5d1704ddbf implement PR4895, by making FoldOpIntoPhi handle select conditions
that are phi nodes.  Also tighten up FoldOpIntoPhi to treat constantexpr
operands to phis just like other variables, avoiding moving constantexpr
computations around.

Patch by Daniel Dunbar.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82913 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 19:57:57 +00:00
Dan Gohman
f37cfed791 Grab an LLVM Context from an instruction that exists rather than one
that is deleted in some situations. This fixes a use-after-free.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82903 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 16:10:30 +00:00
Dan Gohman
e6fe67b2fb Tell ScalarEvolution to forget everything it knows about a loop before
rotating the loop, since loop rotation is a very significant change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82901 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 15:37:03 +00:00
Nick Lewycky
6776064d19 Instruction::clone does not need to take an LLVMContext&. Remove that and
update all the callers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82889 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 07:38:41 +00:00
Dan Gohman
76926b6789 Fix SimplifyLibCalls to transfer attributes from callees rather than
calls, since direct calls don't always reflect the attributes of their
callees.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82867 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 18:10:13 +00:00
Dan Gohman
a23643d5b7 Rename ConstantFP's getInf to getInfinity.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82823 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 23:40:21 +00:00
Dan Gohman
79cb840136 Transform pow(x, 0.5) to (x == -inf ? inf : fabs(sqrt(x))), which is
typically faster then doing a general pow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82819 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 23:10:17 +00:00
Torok Edwin
c338499525 Constant propagating byval pointer is safe if function is readonly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82700 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 18:33:42 +00:00
Torok Edwin
30a94e3b42 Don't constant propagate byval pointers, since they are not really pointers, but
rather structs passed by value.
This fixes PR5038.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82689 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 09:47:18 +00:00
Dale Johannesen
d5405a67d5 A minor improvment in accuracy to inline cost
computation, and some cosmetics.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82660 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 22:05:24 +00:00
Chris Lattner
2b723a5e3d tidy up
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82488 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 22:26:02 +00:00
Chris Lattner
19ad784dac big endian systems shift by bits too, hopefully this will fix the ppc
bootstrap problems.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82464 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 17:55:47 +00:00
Dan Gohman
471fbf9949 Nick pointed out that DominanceFrontier and DominanceTree are preserved
by setPreservesCFG().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82463 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 17:54:42 +00:00
Dan Gohman
5ee98e8713 Remove the special-case for constants in PHI nodes; it's not really
helpful, and it didn't correctly handle the case of constants input
to PHIs for backedges.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82462 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 17:53:35 +00:00
Chris Lattner
8b2bc3d574 fix PR5016, a crash I introduced in GVN handing first class
arrays and structs, which cannot be bitcast to integers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82460 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 17:24:04 +00:00
Chris Lattner
4fbd14e80e enable non-local analysis and PRE of large store -> little load.
This doesn't kick in too much because of phi translation issues,
but this can be resolved in the future.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82447 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 06:48:08 +00:00
Chris Lattner
879135145f convert an std::pair to an explicit struct.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82446 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 06:30:24 +00:00