Commit Graph

11117 Commits

Author SHA1 Message Date
Chris Lattner 2c8efdb348 New testcase for CSE of call instructions
llvm-svn: 12418
2004-03-15 05:44:29 +00:00
Chris Lattner ea42c857d6 Fix a minor bug, implementing GCSE/call_pure_function.ll
Also, add some stuff I missed before.

llvm-svn: 12417
2004-03-15 04:18:28 +00:00
Chris Lattner ecdbee5542 Make sure that pure calls don't kill loads
llvm-svn: 12416
2004-03-15 04:17:53 +00:00
Chris Lattner 20cda2645e Implement LICM of calls in simple cases. This is sufficient to move around
sin/cos/strlen calls and stuff.  This implements:
  LICM/call_sink_pure_function.ll
  LICM/call_sink_const_function.ll

llvm-svn: 12415
2004-03-15 04:11:30 +00:00
Chris Lattner fb5d561193 New testcases to test LICM of call instructions
llvm-svn: 12414
2004-03-15 04:10:08 +00:00
Chris Lattner 21c60f1549 Don't be COMPLETELY pessimistic in the face of function calls
llvm-svn: 12413
2004-03-15 04:08:36 +00:00
Chris Lattner 2f87d5872f Tweak argument
llvm-svn: 12412
2004-03-15 04:08:18 +00:00
Chris Lattner f4c9028b06 Deinline a couple of methods. Improve comment.
llvm-svn: 12411
2004-03-15 04:07:59 +00:00
Chris Lattner a67dbd02cf Deinline some virtual methods, provide better mod/ref answers through the
use of the boolean queries

llvm-svn: 12410
2004-03-15 04:07:29 +00:00
Chris Lattner d441444234 Pass through the boolean queries
llvm-svn: 12409
2004-03-15 04:06:46 +00:00
Chris Lattner d82256a7a1 Teach basicaa about some stdc functions.
llvm-svn: 12408
2004-03-15 03:36:49 +00:00
Chris Lattner 41ab361ae2 Add two new methods which can be used to enable a bunch of transformations
in common cases.

llvm-svn: 12407
2004-03-15 01:58:54 +00:00
Chris Lattner fb87cdecd8 Mostly cosmetic improvements. Do fix the bug where a global value was considered an input.
llvm-svn: 12406
2004-03-15 01:26:44 +00:00
Chris Lattner 73ab1fa7c8 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.

llvm-svn: 12405
2004-03-15 01:18:23 +00:00
Chris Lattner fec74e7ce2 New testcase that causes the code extractor to generate bogus code.
llvm-svn: 12404
2004-03-15 00:08:49 +00:00
Chris Lattner 2f155d8734 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.

llvm-svn: 12403
2004-03-15 00:02:02 +00:00
Chris Lattner 5b2072ecd3 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

llvm-svn: 12402
2004-03-14 23:43:24 +00:00
Chris Lattner b4d8bf365c 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.

llvm-svn: 12401
2004-03-14 23:05:49 +00:00
Chris Lattner 9c431f6c44 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.

llvm-svn: 12400
2004-03-14 22:34:55 +00:00
Chris Lattner 99e9b17641 New testcase that crashes the loop extractor
llvm-svn: 12399
2004-03-14 22:16:52 +00:00
Chris Lattner bcec7875fb After reducing a miscompiled program down to the functions which are being
miscompiled, try to use the loop extractor to reduce the program down to a
loop nest that is being miscompiled.  In practice, the loop extractor appears
to have too many bugs for this to be useful, but hopefully they will be fixed
soon...

llvm-svn: 12398
2004-03-14 22:08:00 +00:00
Chris Lattner 0e6549b8c7 Fix a minor bug in runPassesOn
llvm-svn: 12397
2004-03-14 21:37:41 +00:00
Chris Lattner 37117a0f6a Add a new "AutoDebugCrashes" option
llvm-svn: 12396
2004-03-14 21:21:57 +00:00
Chris Lattner 6ce2d03352 Refactor to use a new method
llvm-svn: 12395
2004-03-14 21:17:22 +00:00
Chris Lattner 1a5c540c27 Add new method
llvm-svn: 12394
2004-03-14 21:17:03 +00:00
Chris Lattner fd72bed301 Refactor and clean up a bunch more code. No major functionality changes.
* Make several methods of bugdriver global functions (ParseInputFile, PrintFunctionList)
 * Make PrintFunctionList truncate the output after 10 entries, like the crash debugger
   did.  This allows code sharing.
 * Add a couple of methods to BugDriver that allows us to eliminate some friends
 * Improve comments in ExtractFunction.cpp
 * Make classes that used to be friends up bugdriver now live in anon namespaces
 * Rip a bunch of functionality in the miscompilation tester into a new
   TestMergedProgram function for future code sharing.
 * Fix a bug in the miscompilation tester induced in my last checkin

llvm-svn: 12393
2004-03-14 20:50:42 +00:00
Alkis Evlogimenos 4837f6c0d9 Another API change to MRegisterInfo::foldMemoryOperand. Instead of a
MachineBasicBlock::iterator take a MachineInstr*.

llvm-svn: 12392
2004-03-14 20:14:27 +00:00
Chris Lattner 3fe96bc9fd Add a method to extract a loop
llvm-svn: 12391
2004-03-14 20:02:07 +00:00
Chris Lattner a1672c1bd8 Split into two passes. Now there is the general loop extractor, usable on
the command line, and the single loop extractor, usable by bugpoint

llvm-svn: 12390
2004-03-14 20:01:36 +00:00
Chris Lattner f624c99379 Rename createLoopExtractorPass to createSingleLoopExtractorPass
Doxygenify

llvm-svn: 12389
2004-03-14 20:00:37 +00:00
Chris Lattner 5a5e414bc0 add a fixme
llvm-svn: 12388
2004-03-14 19:31:00 +00:00
Chris Lattner 567543f09e Refactor all of the "splitting a module into two pieces" code to avoid
code duplication.  Also, don't use ReduceMiscompilingFunctions::TestFuncs
to print out the final message.

llvm-svn: 12387
2004-03-14 19:27:19 +00:00
Alkis Evlogimenos 48da2f8a6d Change MRegisterInfo::foldMemoryOperand to return the folded
instruction to make the API more flexible.

llvm-svn: 12386
2004-03-14 07:19:51 +00:00
Chris Lattner 0137de5ecb Passes don't print stuff!
llvm-svn: 12385
2004-03-14 04:17:53 +00:00
Chris Lattner b68659552a Do not create empty basic blocks when the lowerswitch pass expects blocks to
be non-empty!  This fixes LowerSwitch/2004-03-13-SwitchIsDefaultCrash.ll

llvm-svn: 12384
2004-03-14 04:14:31 +00:00
Chris Lattner e7ae4a8cb4 New testcase that crashes the -lowerswitch pass
llvm-svn: 12383
2004-03-14 04:13:57 +00:00
Chris Lattner 4fca71eb44 Minor random cleanups
llvm-svn: 12382
2004-03-14 04:01:47 +00:00
Chris Lattner 6c3e8c78cf 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

llvm-svn: 12381
2004-03-14 04:01:06 +00:00
Chris Lattner d078812f96 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.

llvm-svn: 12380
2004-03-14 03:59:22 +00:00
Chris Lattner 9ece94b02b 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.

llvm-svn: 12379
2004-03-14 03:23:54 +00:00
Chris Lattner 3684469326 Verify functions as they are produced if -debug is specified. Reduce
curly braceage

llvm-svn: 12378
2004-03-14 03:17:22 +00:00
Chris Lattner b870ca7766 verifyFunction has been broken for a long time now. Fix it.
llvm-svn: 12377
2004-03-14 03:16:15 +00:00
Chris Lattner d828ad5089 New testcase that crashes the loop extractor
llvm-svn: 12376
2004-03-14 03:03:59 +00:00
Chris Lattner 78a996aec4 Move prototype to IPO.h instead of Scalar.h
Make sure that the file interface header (IPO.h) is included first
remove dead #incldue

llvm-svn: 12375
2004-03-14 02:37:16 +00:00
Chris Lattner 6d24a7ce8a Move loop extractor to the IPO header
llvm-svn: 12374
2004-03-14 02:36:34 +00:00
Chris Lattner 692a47aeb9 Indent anon namespace properly, add copyright block
llvm-svn: 12373
2004-03-14 02:34:07 +00:00
Chris Lattner 41ec709e00 Move to the IPO library. Utils shouldn't contain passes.
llvm-svn: 12372
2004-03-14 02:32:27 +00:00
Chris Lattner 96a7fbd503 Remove dead file
llvm-svn: 12371
2004-03-14 02:13:57 +00:00
Chris Lattner 8eebc49884 DemoteRegToStack got moved from DemoteRegToStack.h to Local.h
llvm-svn: 12368
2004-03-14 02:13:38 +00:00
Chris Lattner 3b18771d9f Move DemoteRegToStack prototype out of DemoteRegToStack.h to this file.
llvm-svn: 12367
2004-03-14 02:13:07 +00:00