1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 20:43:44 +02:00
Commit Graph

45 Commits

Author SHA1 Message Date
Chris Lattner
b77e687f6f Handle instructions in the map, but that map to a null pointer.
This unbreaks smg2000.

llvm-svn: 29127
2006-07-12 21:37:11 +00:00
Chris Lattner
0d4c198ecd In addition to deleting calls, the inliner can constant fold them as well.
Handle this case, which doesn't require a new callgraph edge.  This fixes
a crash compiling MallocBench/gs.

llvm-svn: 29121
2006-07-12 18:37:18 +00:00
Chris Lattner
e5e2e8d917 Change the callgraph representation to store the callsite along with the
target CG node.  This allows the inliner to properly update the callgraph
when using the pruning inliner.  The pruning inliner may not copy over all
call sites from a callee to a caller, so the edges corresponding to those
call sites should not be copied over either.

This fixes PR827 and Transforms/Inline/2006-07-12-InlinePruneCGUpdate.ll

llvm-svn: 29120
2006-07-12 18:29:36 +00:00
Chris Lattner
04d52ee9a2 Switch the inliner over to using CloneAndPruneFunctionInto. This effectively
makes it so that it constant folds instructions on the fly.  This is good
for several reasons:

0. Many instructions are constant foldable after inlining, particularly if
   inlining a call with constant arguments.
1. Without this, the inliner has to allocate memory for all of the instructions
   that can be constant folded, then a subsequent pass has to delete them.  This
   gets the job done without this extra work.
2. This makes the inliner *pass* a bit more aggressive: in particular, it
   partially solves a phase order issue where the inliner would inline lots
   of code that folds away to nothing, but think that the resultant function
   is big because of this code that will be gone.  Now the code never exists.

This is the first part of a 2-step process.  The second part will be smart
enough to see when this implicit constant folding propagates a constant into
a branch or switch instruction, making CFG edges dead.

This implements Transforms/Inline/inline_constprop.ll

llvm-svn: 28521
2006-05-27 01:28:04 +00:00
Chris Lattner
fea434f37e Teach the inliner to update the CallGraph itself, and have it add edges to
llvm.stacksave/restore when it inserts calls to them.

llvm-svn: 25320
2006-01-14 20:07:50 +00:00
Chris Lattner
423aeb28d5 If inlining a call to a function that contains dynamic allocas, wrap the
resultant code with llvm.stacksave/llvm.stackrestore intrinsics.

llvm-svn: 25286
2006-01-13 19:34:14 +00:00
Chris Lattner
672f2df6d0 Use ClonedCodeInfo to avoid another walk over the inlined code, this this
time in common C cases.

llvm-svn: 25285
2006-01-13 19:18:11 +00:00
Chris Lattner
6f96396bae Use the ClonedCodeInfo object to avoid scans of the inlined code when
it doesn't contain any calls.  This is a fairly common case for C++ code,
so it will probably speed up the inliner marginally in these cases.

llvm-svn: 25284
2006-01-13 19:15:15 +00:00
Chris Lattner
ec00fcaba6 Refactor a bunch of invoke handling stuff out into a new function
"HandleInlinedInvoke".  No functionality change.

llvm-svn: 25283
2006-01-13 19:05:59 +00:00
Chris Lattner
32ff638ae5 Fix a bug I noticed by inspection: if the first instruction in the inlined
function was not an alloca, we wouldn't check the entry block for any allocas,
leading to increased stack space in some cases.  In practice, allocas are almost
always at the top of the block, so this was never noticed.

llvm-svn: 25280
2006-01-13 18:16:48 +00:00
Jeff Cohen
bd51ec7461 Eliminate all remaining tabs and trailing spaces.
llvm-svn: 22523
2005-07-27 06:12:32 +00:00
Chris Lattner
eff214d7de wrap long lines, preserve calling conventions when cloning functions and
turning calls into invokes

llvm-svn: 21797
2005-05-09 01:04:34 +00:00
Chris Lattner
c9be572154 BAD typeo which caused many testsuite failures last night. Note to self, do
not change code after testing it without retesting!

llvm-svn: 21741
2005-05-06 17:13:16 +00:00
Chris Lattner
0187977904 Implement Transforms/Inline/inline-tail.ll
llvm-svn: 21736
2005-05-06 06:47:52 +00:00
Misha Brukman
53e199440e Remove trailing whitespace
llvm-svn: 21427
2005-04-21 23:48:37 +00:00
Chris Lattner
4b688a1c70 This mega patch converts us from using Function::a{iterator|begin|end} to
using Function::arg_{iterator|begin|end}.  Likewise Module::g* -> Module::global_*.

This patch is contributed by Gabor Greif, thanks!

llvm-svn: 20597
2005-03-15 04:54:21 +00:00
Chris Lattner
8378361f0c The split bb is really the exit of the old function
llvm-svn: 18799
2004-12-11 16:59:54 +00:00
Chris Lattner
9e7ddf8596 Fix Regression/Transforms/Inline/2004-10-17-InlineFunctionWithoutReturn.ll
If a function had no return instruction in it, and the result of the inlined
call instruction was used, we would crash.

llvm-svn: 17104
2004-10-17 23:21:07 +00:00
Reid Spencer
c6a8d70cff Convert code to compile with vc7.1.
Patch contributed by Paolo Invernizzi. Thanks Paolo!

llvm-svn: 16368
2004-09-15 17:06:42 +00:00
Chris Lattner
4e4b8b0ad2 Fix a serious code pessimization problem. If an inlined function has a single
return, clone the 'ret' BB code into the block AFTER the inlined call, not the
other way around.

llvm-svn: 15030
2004-07-20 05:45:24 +00:00
Chris Lattner
06eda01d1b Fix Inline/2004-04-15-InlineDeletesCall.ll
Basically we were using SimplifyCFG as a huge sledgehammer for a simple
optimization.  Because simplifycfg does so many things, we can't use it
for this purpose.

llvm-svn: 12977
2004-04-16 05:17:59 +00:00
Chris Lattner
2265790f9f 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!

llvm-svn: 11384
2004-02-13 16:47:35 +00:00
Chris Lattner
68fdb35576 rename the "exceptional" destination of an invoke instruction to the 'unwind' dest
llvm-svn: 11202
2004-02-08 21:44:31 +00:00
Chris Lattner
cbe1dd55f4 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%)

llvm-svn: 11118
2004-02-04 21:33:42 +00:00
Chris Lattner
790d7321b4 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.

llvm-svn: 11116
2004-02-04 04:17:06 +00:00
Chris Lattner
8f0a362cd4 More refactoring. Move alloca instructions and handle invoke instructions
before we delete the original call site, allowing slight simplifications of
code, but nothing exciting.

llvm-svn: 11109
2004-02-04 02:51:48 +00:00
Chris Lattner
ab01a0e982 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.

llvm-svn: 11108
2004-02-04 01:41:09 +00:00
Chris Lattner
031bd7e9f3 Finegrainify namespacification
llvm-svn: 10727
2004-01-09 06:12:26 +00:00
Chris Lattner
feeb3261f2 Start using the nicer terminator auto-insertion API
llvm-svn: 10111
2003-11-20 18:25:24 +00:00
Brian Gaeke
d25f86d683 Put all LLVM code into the llvm namespace, as per bug 109.
llvm-svn: 9903
2003-11-11 22:41:34 +00:00
Chris Lattner
4fb1540128 Get the list of PHI node values before the basic block is split. Also, add
PHI node entries for unwind instructions just like for call instructions which
became invokes!  This fixes PR57, tested by
Inline/2003-10-26-InlineInvokeExceptionDestPhi.ll

llvm-svn: 9526
2003-10-27 05:33:09 +00:00
John Criswell
b402729b30 Added LLVM project notice to the top of every C++ source file.
Header files will be on the way.

llvm-svn: 9298
2003-10-20 19:43:21 +00:00
Chris Lattner
a567862e89 Do not move variable sized allocations to the top of the caller, which might
break dominance relationships, and is otherwise bad.  This fixes bug:
Inline/2003-10-13-AllocaDominanceProblem.ll.  This also fixes miscompilation
of 3 176.gcc source files (reload1.c, global.c, flow.c)

llvm-svn: 9109
2003-10-14 01:11:07 +00:00
Chris Lattner
5b814e067a Avoid doing pointless work. Amazingly, this makes us go faster.
Running the inliner on 252.eon used to take 48.4763s, now it takes 14.4148s.

In release mode, it went from taking 25.8741s to taking 11.5712s.

This also fixes a FIXME.

llvm-svn: 8890
2003-10-06 15:23:43 +00:00
Chris Lattner
253c5f582e Fix bugs in the last change
llvm-svn: 8667
2003-09-22 23:30:59 +00:00
Chris Lattner
7ff5b8a024 Fix bug: Inline/2003-09-22-PHINodesInNormalInvokeDest.ll
llvm-svn: 8666
2003-09-22 22:35:39 +00:00
Chris Lattner
2cb1e9f0a6 Fix bug: Inline/2003-09-22-PHINodesInExceptionDest.ll
... by making sure to update PHI nodes to take into consideration the
extra edges we get if we inline a call instruction through an invoke.

llvm-svn: 8664
2003-09-22 21:59:27 +00:00
Chris Lattner
7a55e0b56d Fix bug: Inline/2003-09-14-InlineValue.ll
llvm-svn: 8514
2003-09-15 02:10:16 +00:00
Chris Lattner
e8ae7bf114 Eliminate support for the llvm.unwind intrinisic, using the Unwind instruction instead
llvm-svn: 8411
2003-09-08 19:44:26 +00:00
Chris Lattner
5f9de6e523 Should invokify is always true
llvm-svn: 8409
2003-09-08 19:00:30 +00:00
Chris Lattner
399ad7c300 Remove special casing
llvm-svn: 8144
2003-08-25 22:34:15 +00:00
Chris Lattner
7e3e38b76d rethrow is really the language independent primitive here. "throw" can be written
in terms of it and llvm.exc.setcurrent.
Rework the intrinsics.

llvm-svn: 8111
2003-08-24 12:24:11 +00:00
Chris Lattner
d5be33fded *** Implement inlining of Invoke instructions!
llvm-svn: 8106
2003-08-24 06:59:16 +00:00
Chris Lattner
b3db526a4f Implement: Inline/cfg_preserve_test.ll
llvm-svn: 8099
2003-08-24 04:06:56 +00:00
Chris Lattner
24947af013 * Separate all of the grunt work of inlining out into the Utils library.
* Make the function inliner _significantly_ smarter.  :)

llvm-svn: 6396
2003-05-29 15:11:31 +00:00