Commit Graph

5869 Commits

Author SHA1 Message Date
Chris Lattner
15d443b566 Mostly cosmetic improvements. Do fix the bug where a global value was considered an input.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12406 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-15 01:26:44 +00:00
Chris Lattner
0de632bfae Assert that input blocks meet the invariants we expect
Simplify the input/output finder.  All elements of a basic block are
instructions.  Any used arguments are also inputs.  An instruction can only
be used by another instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12405 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-15 01:18:23 +00:00
Chris Lattner
5156c39d64 Fix several bugs in the loop extractor. In particular, subloops were never
extracted, and a function that contained a single top-level loop never had
the loop extracted, regardless of how much non-loop code there was.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12403 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-15 00:02:02 +00:00
Chris Lattner
65826bf435 No correctness fixes here, just minor qoi fixes:
* Don't insert a branch to the switch instruction after the call, just
  make it a single block.
* Insert the new alloca instructions in the entry block of the original
  function instead of having them execute dynamically
* Don't make the default edge of the switch instruction go back to the switch.
  The loop extractor shouldn't create new loops!
* Give meaningful names to the alloca slots and the reload instructions
* Some minor code simplifications


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12402 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-14 23:43:24 +00:00
Chris Lattner
12f390e9c0 Simplify code a bit, and fix bug CodeExtractor/2004-03-14-NoSwitchSupport.ll
This also implements a two minor improvements:
  * Don't insert live-out stores IN the region, insert them on the code path
    that exits the region
  * If the region is exited to the same block from multiple paths, share the
    switch statement entry, live-out store code, and the basic block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12401 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-14 23:05:49 +00:00
Chris Lattner
0e06674287 Simplify the code a bit by making the collection of basic blocks to extract
a member of the class.  While we're at it, turn the collection into a set
instead of a vector to improve efficiency and make queries simpler.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12400 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-14 22:34:55 +00:00
Alkis Evlogimenos
a1a7148c4d Another API change to MRegisterInfo::foldMemoryOperand. Instead of a
MachineBasicBlock::iterator take a MachineInstr*.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12392 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-14 20:14:27 +00:00
Chris Lattner
41bc0b069c Split into two passes. Now there is the general loop extractor, usable on
the command line, and the single loop extractor, usable by bugpoint


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12390 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-14 20:01:36 +00:00
Alkis Evlogimenos
39354c99a1 Change MRegisterInfo::foldMemoryOperand to return the folded
instruction to make the API more flexible.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12386 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-14 07:19:51 +00:00
Chris Lattner
97836fad2c Passes don't print stuff!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12385 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-14 04:17:53 +00:00
Chris Lattner
bf9eaddfb0 Do not create empty basic blocks when the lowerswitch pass expects blocks to
be non-empty!  This fixes LowerSwitch/2004-03-13-SwitchIsDefaultCrash.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12384 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-14 04:14:31 +00:00
Chris Lattner
bb41156c0c Minor random cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12382 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-14 04:01:47 +00:00
Chris Lattner
16d0eb0468 FunctionPass's should not define their own 'run' method.
Require 'simplified' loops, not just raw natural loops.  This fixes
CodeExtractor/2004-03-13-LoopExtractorCrash.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12381 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-14 04:01:06 +00:00
Chris Lattner
2ef703ec42 If a block is dead, dominators will not be calculated for it. Because of this
loop information won't see it, and we could have unreachable blocks pointing to
the non-header node of blocks in a natural loop.  This isn't tidy, so have the
loopsimplify pass clean it up.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12380 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-14 03:59:22 +00:00
Chris Lattner
59c3569b14 Catch some more cases of broken code. The loop extractor seems to be creating
situations where there is a branch that goes to a block in another function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12379 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-14 03:23:54 +00:00
Chris Lattner
ffada93273 Verify functions as they are produced if -debug is specified. Reduce
curly braceage


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12378 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-14 03:17:22 +00:00
Chris Lattner
2eff85941f verifyFunction has been broken for a long time now. Fix it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12377 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-14 03:16:15 +00:00
Chris Lattner
1e3cb34753 Move prototype to IPO.h instead of Scalar.h
Make sure that the file interface header (IPO.h) is included first
remove dead #incldue


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12375 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-14 02:37:16 +00:00
Chris Lattner
efddcfa0df Indent anon namespace properly, add copyright block
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12373 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-14 02:34:07 +00:00
Chris Lattner
c3c8703c3b Move to the IPO library. Utils shouldn't contain passes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12372 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-14 02:32:27 +00:00
Chris Lattner
a2dc727ac4 DemoteRegToStack got moved from DemoteRegToStack.h to Local.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12368 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-14 02:13:38 +00:00
Chris Lattner
0cea42a560 Add some debugging output
Fix InstCombine/2004-03-13-InstCombineInfLoop.ll which caused an infinite
loop compiling (I think) povray.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12365 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-13 23:54:27 +00:00
Chris Lattner
619d3544b1 This change makes two big adjustments.
* Be a lot more accurate about what the effects will be when inlining a call
   to a function when an argument is an alloca.
 * Dramatically reduce the penalty for inlining a call in a large function.
   This heuristic made it almost impossible to inline a function into a large
   function, no matter how small the callee is.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12363 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-13 23:15:45 +00:00
Chris Lattner
786c5646e9 This little patch speeds up the loop used to update the dominator set analysis.
On the testcase from GCC PR12440, which has a LOT of loops (1392 of which require
preheaders to be inserted), this speeds up the loopsimplify pass from 1.931s to
0.1875s.  The loop in question goes from 1.65s -> 0.0097s, which isn't bad. All of
these times are a debug build.

This adds a dependency on DominatorTree analysis that was not there before, but
we always had dominatortree available anyway, because LICM requires both loop
simplify and DT, so this doesn't add any extra analysis in practice.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12362 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-13 22:01:26 +00:00
Chris Lattner
cc7c4acffa Fix a tiny bug that caused an incorrect assertion failure poolallocating
boxed-sim.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12358 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-13 01:14:23 +00:00
Chris Lattner
5634b9f5e7 It helps if I save the file. :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12357 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-13 00:24:52 +00:00
Chris Lattner
317201d773 Rename the intrinsic enum values for llvm.va_* from Intrinsic::va_* to
Intrinsic::va*.  This avoid conflicting with macros in the stdlib.h file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12356 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-13 00:24:00 +00:00
Chris Lattner
bfe492b5c2 Implement sub.ll:test14
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12355 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-13 00:11:49 +00:00
Chris Lattner
9c2906744a Implement InstCombine/sub.ll:test12 & test13
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12353 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-12 23:53:13 +00:00
Chris Lattner
7a82ba0510 Fix a couple of minor problems. Because PHI nodes can use themselves, this
could cause infinite loops.  Also, getUnderlyingObject can return null


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12351 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-12 23:12:55 +00:00
Chris Lattner
04b7593546 Implement mod/ref analysis for a trivial case where locals don't escape.
This comes up when you have a local array on the stack and you never pass
the address of elements around.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12349 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-12 22:39:00 +00:00
Brian Gaeke
215fb76865 Make -print-machineinstrs show us the code both before and after reg. alloc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12344 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-12 21:19:08 +00:00
Alkis Evlogimenos
a3f66842b2 Add support for a wider range of CMOV instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12336 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-12 17:59:56 +00:00
Misha Brukman
85f5e11c06 Simplify code to process CallSites (thanks to Chris).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12334 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-12 16:20:49 +00:00
Misha Brukman
4230f40add Keep transitively-required passes alive for queries to work after the initial
user pass is destroyed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12332 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-12 06:16:28 +00:00
Misha Brukman
bc1dbe95b8 Evaluate ModRef information in addition to regular ol' pointer analysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12331 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-12 06:15:08 +00:00
Misha Brukman
a975a9ab80 Implement getModRefInfo() for DSA to calculate whether a function modifies or
references a pointer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12330 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-12 06:14:22 +00:00
Chris Lattner
230c1a7222 Add support for checking the select instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12325 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-12 05:54:31 +00:00
Chris Lattner
b4f4880eba Know the opcode name of the select instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12324 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-12 05:54:20 +00:00
Chris Lattner
08a45cc2ff Add support for select constant expressions. Use reserve a bit more to avoid
memory wasteage.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12323 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-12 05:54:04 +00:00
Chris Lattner
647f82be07 Add new function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12322 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-12 05:53:41 +00:00
Chris Lattner
e97148628f Teach the constant folder how to do select instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12321 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-12 05:53:32 +00:00
Chris Lattner
cfdd148972 Print select instructions correctly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12320 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-12 05:53:14 +00:00
Chris Lattner
17fd273512 Add constant folding wrapper support for select instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12319 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-12 05:53:03 +00:00
Chris Lattner
6e32372fcd Add sccp support for select instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12318 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-12 05:52:44 +00:00
Chris Lattner
3d69f46d64 Add trivial optimizations for select instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12317 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-12 05:52:32 +00:00
Chris Lattner
9f24a077bd ADd support for select instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12316 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-12 05:52:14 +00:00
Chris Lattner
46b787e986 Write select instructions to bytecode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12315 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-12 05:52:01 +00:00
Chris Lattner
e3ac22a204 Read select instrs from bytecode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12314 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-12 05:51:49 +00:00
Chris Lattner
76f0ff394d Allow parsing select instruction and constant expr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12313 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-12 05:51:36 +00:00