Commit Graph

1207 Commits

Author SHA1 Message Date
Chris Lattner
c5943fb186 Implement cast.ll::test14/15
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11742 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 07:16:20 +00:00
Chris Lattner
4cb170cc6e Refactor some code. In the mul - setcc folding case, we really care about
whether this is the sign bit or not, so check unsigned comparisons as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11740 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 06:38:22 +00:00
Chris Lattner
fed58fd72e Implement mul.ll:test11
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11737 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 06:00:11 +00:00
Chris Lattner
45aaafef49 Implement "strength reduction" of X <= C and X >= C
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11735 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 05:47:48 +00:00
Chris Lattner
fb54b2b744 Implement InstCombine/mul.ll:test10, which is a case that occurs when dealing
with "predication"


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11734 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-23 05:39:21 +00:00
Chris Lattner
c6bd195336 Implement Transforms/InstCombine/cast.ll:test13, a case which occurs in a
hot 164.gzip loop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11702 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-22 05:25:17 +00:00
Chris Lattner
57cb9883aa Fix PR245: Linking weak and strong global variables is dependent on link order
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11565 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 21:56:04 +00:00
Chris Lattner
19831ec853 Implement test/Regression/Transforms/SimplifyCFG/UncondBranchToReturn.ll,
see the testcase for the reasoning.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11496 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-16 06:35:48 +00:00
Chris Lattner
7059f2e76b Fold PHI nodes of constants which are only used by a single cast. This implements
phi.ll:test4


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11494 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-16 05:07:08 +00:00
Chris Lattner
26ca7e145e Teach LLVM to unravel the "swap idiom". This implements:
Regression/Transforms/InstCombine/xor.ll:test20


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11492 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-16 03:54:20 +00:00
Chris Lattner
c317d39887 Implement Transforms/InstCombine/xor.ll:test19
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11490 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-16 01:20:27 +00:00
Chris Lattner
860a16143c Instead of producing calls to setjmp/longjmp, produce uses of the
llvm.setjmp/llvm.longjmp intrinsics.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11482 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 22:24:27 +00:00
Chris Lattner
de512b5b2e Adjustments to support the new ConstantAggregateZero class
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11474 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 05:55:15 +00:00
Chris Lattner
04d1fb6df9 Remove dependence on return type of ConstantStruct::get
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11466 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 04:07:32 +00:00
Chris Lattner
371064481a Remove dependence on the return type of ConstantArray::get
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11463 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 04:05:58 +00:00
Chris Lattner
494b6920b0 Fix compilation of 126.gcc: intrinsic functions cannot throw, so they are not
allowed in invoke instructions.  Thus, if we are inlining a call to an intrinsic
function into an invoke site, we don't need to turn the call into an invoke!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11384 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 16:47:35 +00:00
Chris Lattner
0db085baec Intrinsic functions cannot throw
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11383 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 16:46:46 +00:00
Chris Lattner
cefc18e7d9 Expose a pass ID that can be 'required'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11376 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 16:16:16 +00:00
Chris Lattner
5f55aaf0f0 Remove obsolete comment. Unreachable blocks will automatically be left at the
end of the function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11313 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-11 05:20:50 +00:00
Chris Lattner
206805e172 Add an _embarassingly simple_ implementation of basic block layout. This is
more of a testcase for profiling information than anything that should reasonably
be used, but it's a starting point.  When I have more time I will whip this into
better shape.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11311 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-11 04:53:20 +00:00
Chris Lattner
723c66d4c0 Implement SimplifyCFG/PhiEliminate.ll
Having a proper 'select' instruction would allow the elimination of a lot
of the special case cruft in this patch, but we don't have one yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11307 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-11 03:36:04 +00:00
Chris Lattner
2355f948c5 The hasConstantReferences predicate always returns false.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11301 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-11 01:17:07 +00:00
Chris Lattner
81d1a2207d initialization calls now return argc. If the program uses the argc value
passed into main, make sure they use the return value of the init call
instead of the one passed in.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11262 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-10 17:41:01 +00:00
Chris Lattner
f1d0d3519f Only add the global variable with the abort message if an unwind actually
occurs in the program.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11249 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 22:48:47 +00:00
Chris Lattner
68b86f4f41 Don't depend on auto data conversion
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11229 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 05:16:30 +00:00
Chris Lattner
d21cd809b6 Adjust to the changed StructType interface. In particular, getElementTypes() is gone.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11228 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 04:37:31 +00:00
Chris Lattner
d5d8996720 Start using the new and improve interface to FunctionType arguments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11224 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 04:14:01 +00:00
Chris Lattner
99d6b8ec95 The ConstantExpr::getCast call can cause a CPR to be generated. If so,
strip it off.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11213 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 00:20:55 +00:00
Misha Brukman
b9806e0101 Fix grammar-o.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11210 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-08 22:27:33 +00:00
Chris Lattner
501825e08a Improve compatibility with programs that already have a prototype for 'write',
even if it is wierd in some way.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11207 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-08 22:14:44 +00:00
Chris Lattner
aeb2a1d708 rename the "exceptional" destination of an invoke instruction to the 'unwind' dest
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11202 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-08 21:44:31 +00:00
Chris Lattner
e0def04e43 Fix PR225: [pruneeh] -pruneeh pass removes invoke instructions it shouldn't
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11200 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-08 21:15:59 +00:00
Chris Lattner
edb1cf0c19 splitBasicBlock "does the right thing" now, no reason to reposition it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11199 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-08 20:49:07 +00:00
Chris Lattner
6d78457f17 Implement proper invoke/unwind lowering.
This fixed PR16 "[lowerinvoke] The -lowerinvoke pass does not insert calls to setjmp/longjmp"


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11195 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-08 19:53:56 +00:00
Chris Lattner
e1c09309f2 Add a call to 'write' right before the call to abort() in the unwind path.
This causes the JIT, or LLC'd program to print out a nice message, explaining
WHY the program aborted.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11184 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-08 07:30:29 +00:00
Chris Lattner
99dcc1da86 Fix another dominator update bug. These bugs keep getting exposed because GCSE
keeps finding more code motion opportunities now that the dominators are correct!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11142 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-05 23:20:59 +00:00
Chris Lattner
3e0b870def Fix bug updating dominators
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11140 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-05 22:33:26 +00:00
Chris Lattner
79fc865ccb Add debug output
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11139 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-05 22:33:19 +00:00
Chris Lattner
4f02fc28eb Fix PR223: Loopsimplify incorrectly updates dominator information
The problem is that the dominator update code didn't "realize" that it's
possible for the newly inserted basic block to dominate anything.  Because
it IS possible, stuff was getting updated wrong.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11137 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-05 21:12:24 +00:00
Chris Lattner
a33ceaa2d4 Minor speedup, don't query ValueMap each time through the loop
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11123 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-04 21:44:26 +00:00
Chris Lattner
c1df7e1799 Two changes:
1. Don't scan to the end of alloca instructions in the caller function to
     insert inlined allocas, just insert at the top.  This saves a lot of
     time inlining into functions with a lot of allocas.
  2. Use splice to move the alloca instructions over, instead of remove/insert.
     This allows us to transfer a block at a time, and eliminates a bunch of
     silly symbol table manipulations.

This speeds up the inliner on the testcase in PR209 from 1.73s -> 1.04s (67%)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11118 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-04 21:33:42 +00:00
Chris Lattner
44a6807f4f Optimize the case where we are inlining a function that contains only one basic block,
and that basic block ends with a return instruction.  In this case, we can just splice
the cloned "body" of the function directly into the source basic block, avoiding a lot
of rearrangement and splitBasicBlock's linear scan over the split block.  This speeds up
the inliner on the testcase in PR209 from 2.3s to 1.7s, a 35% reduction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11116 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-04 04:17:06 +00:00
Chris Lattner
c24a076c6a Adjust to the new BasicBlock ctor, which requires a function parameter
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11114 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-04 03:58:28 +00:00
Chris Lattner
3b332fd376 Remove unneeded code now that splitBasicBlock does the "right thing"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11111 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-04 03:21:51 +00:00
Chris Lattner
5e923dee60 More refactoring. Move alloca instructions and handle invoke instructions
before we delete the original call site, allowing slight simplifications of
code, but nothing exciting.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11109 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-04 02:51:48 +00:00
Chris Lattner
5052c911ec Move the cloning of the function body much earlier in the inlinefunction
process.  The only optimization we did so far is to avoid creating a
PHI node, then immediately destroying it in the common case where the
callee has one return statement.  Instead, we just don't create the return
value.  This has no noticable performance impact, but paves the way for
future improvements.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11108 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-04 01:41:09 +00:00
Chris Lattner
23b4c68f46 Give CloneBasicBlock an optional function argument to specify which function
to add the cloned block to.  This allows the block to be added to the function
immediately, and all of the instructions to be immediately added to the function
symbol table, which speeds up the inliner from 3.7 -> 3.38s on the PR209.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11107 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-04 01:19:43 +00:00
Chris Lattner
e47f78ed12 Bunch up all locally used allocas by the block they are allocated in, and
process them all as a group.  This speeds up SRoA/mem2reg from 28.46s to
0.62s on the testcase from PR209.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11100 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-03 22:34:12 +00:00
Chris Lattner
7fecc2e5e2 Handle extremely trivial cases extremely efficiently. This speeds up
SRoA/mem2reg from 41.2s to 27.5s on the testcase in PR209.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11099 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-03 22:00:33 +00:00
Chris Lattner
0517e72096 Disable (x - (y - z)) => (x + (z - y)) optimization for floating point.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11083 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-02 20:09:56 +00:00