summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Fix PR7272: when inlining through a callsite with byval arguments,Duncan Sands2010-05-311-0/+24
| | | | | | | the newly created allocas may be used by inlined calls, so these need to have their tail call flags cleared. Fixes PR7272. llvm-svn: 105255
* The memcpy intrinsic only takes i8* for %src and %dst, so cast them to thatNick Lewycky2010-05-311-0/+20
| | | | | | first. Fixes PR7265. llvm-svn: 105206
* Add missing space; works for me.Dale Johannesen2010-05-281-1/+1
| | | | llvm-svn: 104992
* Teach instcombine to promote alloca array sizes.Dan Gohman2010-05-281-3/+17
| | | | llvm-svn: 104945
* Add a testcase for getelementptr index promotion.Dan Gohman2010-05-281-0/+9
| | | | llvm-svn: 104944
* Do not drop location info for inlined function args.Devang Patel2010-05-271-0/+52
| | | | llvm-svn: 104884
* Teach instCombine to remove malloc+free if malloc's only uses are comparisonsDuncan Sands2010-05-272-4/+17
| | | | | | to null. Patch by Matti Niemenmaa. llvm-svn: 104871
* Properly promote operands when optimizing a single-character memcmp.Benjamin Kramer2010-05-251-1/+13
| | | | llvm-svn: 104648
* Actually run the test. Thanks Daniel Dunbar!Nick Lewycky2010-05-131-1/+1
| | | | llvm-svn: 103720
* Add testcase for r103653.Nick Lewycky2010-05-131-0/+28
| | | | llvm-svn: 103699
* make simplifycfg insert an llvm.trap before the 'unreachable' it introducesChris Lattner2010-05-081-3/+17
| | | | | | | | | | | | | | | | | | | | | when it detects undefined behavior. llvm.trap generally codegens into some thing really small (e.g. a 2 byte ud2 instruction on x86) and debugging this sort of thing is "nontrivial". For example, we now compile: void foo() { *(int*)0 = 42; } into: _foo: pushl %ebp movl %esp, %ebp ud2 Some may even claim that this is a security hole, though that seems dubious to me. This addresses rdar://7958343 - Optimizing away null dereference potentially allows arbitrary code execution llvm-svn: 103356
* Teach instcombine to transform a bitcast/(zext|trunc)/bitcast sequenceChris Lattner2010-05-081-0/+33
| | | | | | | | | | | with a vector input and output into a shuffle vector. This sort of sequence happens when the input code stores with one type and reloads with another type and then SROA promotes to i96 integers, which make everyone sad. This fixes rdar://7896024 llvm-svn: 103354
* Fix PR7052, patch by Jakub Staszak!Chris Lattner2010-05-081-0/+63
| | | | llvm-svn: 103347
* Update test to use valid debug info.Devang Patel2010-05-071-24/+37
| | | | llvm-svn: 103287
* Add an LLVM IR version of code sinking. This uses the same simple algorithmDan Gohman2010-05-072-0/+25
| | | | | | as MachineSink, but it isn't constrained by MachineInstr-level details. llvm-svn: 103257
* Use llvm.foo as the intrinsic, rather than llvm.dbg.value. Since theDuncan Sands2010-05-041-4/+3
| | | | | | | | values passed to llvm.dbg.value were not valid for the intrinsic, it might have caused trouble one day if the verifier ever started checking for valid debug info. llvm-svn: 103038
* Fix a variant of PR6112 found by thinking about it: when doingDuncan Sands2010-05-041-4/+12
| | | | | | | | | | RAUW of a global variable with a local variable in function F, if function local metadata M in function G was using the global then M would become function-local to both F and G, which is not allowed. See the testcase for an example. Fixed by detecting this situation and zapping the metadata operand when it occurs. llvm-svn: 103007
* Check for side effects before splitting loop.Devang Patel2010-05-032-0/+61
| | | | | | Patch by Jakub Staszak! llvm-svn: 102928
* revert r102831. We already delete dead readonly calls inChris Lattner2010-05-011-1/+1
| | | | | | | other places, killing a valid transformation is not the right answer. llvm-svn: 102850
* Disable the call-deletion transformation introduced in r86975. WithoutOwen Anderson2010-05-011-1/+1
| | | | | | | | | | halting analysis, it is illegal to delete a call to a read-only function. The correct solution is almost certainly to add a "must halt" attribute and only allow deletions in its presence. XFAIL the relevant testcase for now. llvm-svn: 102831
* fix PR5009 by making CGSCCPM realize that a call was devirtualizedChris Lattner2010-05-011-0/+79
| | | | | | | if an indirect call site was removed and a direct one was added, not just if an indirect call site was modified to be direct. llvm-svn: 102830
* rename testChris Lattner2010-05-011-0/+0
| | | | llvm-svn: 102829
* Implement rdar://6295824 and PR6724 with two tiny changesChris Lattner2010-05-011-0/+182
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that can have a big effect :). The first is to enable the iterative SCC passmanager juice that kicks in when the scc passmgr detects that a function pass has devirtualized a call. In this case, it will rerun all the passes it manages on the SCC, up to the iteration count limit (4). This is useful because a function pass may devirualize a call, and we want the inliner to inline it, or pruneeh to infer stuff about it, etc. The second patch is to add *all* call sites to the DevirtualizedCalls list the inliner uses. This list is about to get renamed, but the jist of this is that the inliner now reconsiders *all* inlined call sites as candidates for further inlining. The intuition is this that in cases like this: f() { g(1); } g(int x) { h(x); } We analyze this bottom up, and may decide that it isn't profitable to inline H into G. Next step, we decide that it is profitable to inline G into F, and do so, which means that F now calls H. Even though the call from G -> H may not have been profitable to inline, the call from F -> H may be (in this case because a constant allows folding etc). In my spot checks, this doesn't have a big impact on code. For example, the LLC output for 252.eon grew from 0.02% (from 317252 to 317308) and 176.gcc actually shrunk by .3% (from 1525612 to 1520964 bytes). 252.eon never iterated in the SCC Passmgr, 176.gcc iterated at most 1 time. llvm-svn: 102823
* The inliner has traditionally not considered call sitesChris Lattner2010-05-011-2/+43
| | | | | | | | | | | | | | | | | that appear due to inlining a callee as candidates for futher inlining, but a recent patch made it do this if those call sites were indirect and became direct. Unfortunately, in bizarre cases (see testcase) doing this can cause us to infinitely inline mutually recursive functions into callers not in the cycle. Fix this by keeping track of the inline history from which callsite inline candidates got inlined from. This shouldn't affect any "real world" code, but is required for a follow on patch that is coming up next. llvm-svn: 102822
* Dan recently disabled recursive inlining within a function, but weChris Lattner2010-04-302-92/+32
| | | | | | | | | | | | | | | | | | were still inlining self-recursive functions into other functions. Inlining a recursive function into itself has the potential to reduce recursion depth by a factor of 2, inlining a recursive function into something else reduces recursion depth by exactly 1. Since inlining a recursive function into something else is a weird form of loop peeling, turn this off. The deleted testcase was added by Dale in r62107, since then we're leaning towards not inlining recursive stuff ever. In any case, if we like inlining recursive stuff, it should be done within the recursive function itself to get the algorithm recursion depth win. llvm-svn: 102798
* Preserve debug info attached with call instruction while eliminating dead ↵Devang Patel2010-04-301-0/+68
| | | | | | | | argument. Radar 7927803 llvm-svn: 102760
* fix this to work with objdir != srcdirChris Lattner2010-04-281-1/+1
| | | | llvm-svn: 102547
* fix PR6112 - When globalopt (or any other pass) does RAUW(@G, %G), Chris Lattner2010-04-281-0/+19
| | | | | | | metadata references in non-function-local MDNodes should drop to null. llvm-svn: 102519
* fix PR6940: sitofp(undef) folds to 0.0, not undef.Chris Lattner2010-04-261-2/+13
| | | | llvm-svn: 102358
* no longer xfailChris Lattner2010-04-231-2/+1
| | | | llvm-svn: 102220
* fix some failures my callgraph dump format change broke.Chris Lattner2010-04-231-1/+1
| | | | llvm-svn: 102197
* testcase for the bug that required a patch to be reverted.Chris Lattner2010-04-231-0/+31
| | | | llvm-svn: 102195
* disable my previous inliner patch, it appears to be busting self-host.Chris Lattner2010-04-231-0/+1
| | | | llvm-svn: 102153
* The inliner was choosing to not consider call sitesChris Lattner2010-04-221-2/+30
| | | | | | | | | | that appear in the SCC as a result of inlining as candidates for inlining. Change this so that it *does* consider call sites that change from being indirect to being direct as a result of inlining. This allows it to completely "devirtualize" the testcase. llvm-svn: 102146
* add a DEBUG call so that -debug lists when CGSCCPM iterates.Chris Lattner2010-04-221-0/+29
| | | | | | | | | Fix RefreshCallGraph to use CGN->replaceCallEdge instead of hand rolling its own loop. replaceCallEdge properly maintains the reference counts of the nodes, fixing a crash exposed by the iterative callgraph stuff. llvm-svn: 102120
* Implement (but don't enable) PR6724 and rdar://6295824. In short,Chris Lattner2010-04-211-0/+23
| | | | | | | | | | | | | | | we have RefreshCallGraph detect when a function pass devirtualizes a call, and have CGSCCPassMgr iterate (up to a count) when this happens. This allows (in the example) GVN to devirtualize the call in foo, then the inliner to inline it away. This is not currently enabled because I haven't done any analysis on the (potentially substantial) code size or performance impact of doing this, and guess what, it exposes callgraph updating bugs in various passes. This is progress though, and you can play with it by passing -max-cg-scc-iterations=5 to opt. llvm-svn: 101973
* Revert r101471. For tight recursive functions which have multipleDan Gohman2010-04-211-29/+0
| | | | | | | | | recursive callsites, inlining can reduce the number of calls by exponential factors, as it does in MultiSource/Benchmarks/Olden/treeadd. More involved heuristics will be needed. llvm-svn: 101969
* RewriteLoopBodyWithConditionConstant can end up rewriting theChris Lattner2010-04-201-0/+19
| | | | | | | | condition we're unswitching on. In this case, don't try to simplify the second copy of the loop which may be dead or not, but is probably a constant now. This fixes PR6879 llvm-svn: 101870
* Fix rdar://7879828 - crash in CallGraph, a self host issue.Chris Lattner2010-04-201-0/+38
| | | | | | | | Arg promotion was deleting call graph nodes that still had references from the 'indirect' CGN. Like the inliner, it should only delete the function if all references are gone. llvm-svn: 101845
* Remove the Expr member from IVUsers. Instead of remembering the expression,Dan Gohman2010-04-191-0/+24
| | | | | | | just ask ScalarEvolution for it on demand. This helps IVUsers be more robust in the case of expressions changing underneath it. This fixes PR6862. llvm-svn: 101819
* Fix declarations in a few more tests.Nick Lewycky2010-04-172-3/+3
| | | | llvm-svn: 101676
* Fix intrinsic signature in this test.Nick Lewycky2010-04-171-1/+1
| | | | llvm-svn: 101674
* Re-commit my previous SSAUpdater changes. The previous version naively triedBob Wilson2010-04-171-0/+46
| | | | | | | | | | | to determine where to place PHIs by iteratively comparing reaching definitions at each block. That was just plain wrong. This version now computes the dominator tree within the subset of the CFG where PHIs may need to be placed, and then places the PHIs in the iterated dominance frontier of each definition. The rest of the patch is mostly the same, with a few more performance improvements added in. llvm-svn: 101612
* Disable inlining of recursive calls. It can complicate tailcallelim andDan Gohman2010-04-161-0/+29
| | | | | | | dependent analyses, and increase code size, so doing it profitably would require more complex heuristics. llvm-svn: 101471
* Refine the detection of seemingly infinitely recursive calls where theDan Gohman2010-04-161-1/+25
| | | | | | | callee is expected to be expanded to something else by codegen, so that normal infinitely recursive calls are still transformed. llvm-svn: 101468
* move comment.Chris Lattner2010-04-161-1/+1
| | | | llvm-svn: 101433
* fix PR6832: we were using the alignment of a pointer when we Chris Lattner2010-04-161-0/+32
| | | | | | wanted the alignment of the pointee. llvm-svn: 101432
* Trim tests and convert to FileCheck.Evan Cheng2010-04-142-48/+13
| | | | llvm-svn: 101277
* Revert r101213.Nick Lewycky2010-04-141-0/+1
| | | | llvm-svn: 101231
* Commit testcase for r101213.Nick Lewycky2010-04-141-0/+12
| | | | llvm-svn: 101214
OpenPOWER on IntegriCloud