summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* When removing a function from the function set and adding it to deferred, weNick Lewycky2011-02-091-2/+19
| | | | | | | | | | | | | could end up removing a different function than we intended because it was functionally equivalent, then end up with a comparison of a function against itself in the next round of comparisons (the one in the function set and the one on the deferred list). To fix this, I introduce a choice in the form of comparison for ComparableFunctions, either normal or "pointer only" used to find exact Function*'s in lookups. Also add some debugging statements. llvm-svn: 125180
* Don't split any loop backedges, including backedges of loops other thanDan Gohman2011-02-081-15/+17
| | | | | | | | the active loop. This is generally desirable, and it avoids trouble in situations such as the testcase in PR9123, though the failure mode depends on use-list order, so it is infeasible to test. llvm-svn: 125065
* SimplifyCFG: Track the number of used icmps when turning a icmp chain into a ↵Benjamin Kramer2011-02-071-7/+22
| | | | | | | | switch. If we used only one icmp, don't turn it into a switch. Also prevent the switch-to-icmp transform from creating identity adds, noticed by Marius Wachtler. llvm-svn: 125056
* enhance vmcore to know that udiv's can be exact, and add a trivialChris Lattner2011-02-061-2/+2
| | | | | | | | instcombine xform to exercise this. Nothing forms exact udivs yet though. This is progress on PR8862 llvm-svn: 124992
* Simplify away redundant test, and document what's going on.Nick Lewycky2011-02-061-2/+5
| | | | llvm-svn: 124977
* Remove specialized comparison of InlineAsm objects. They're uniqued on creationNick Lewycky2011-02-061-6/+2
| | | | | | now, and this wasn't comparing some of their relevant bits anyhow. llvm-svn: 124976
* SimplifyCFG: Also transform switches that represent a range comparison but ↵Benjamin Kramer2011-02-031-6/+17
| | | | | | | | are not sorted into sub+icmp. This transforms another 1000 switches in gcc.c. llvm-svn: 124826
* SimplifyCFG: Turn switches into sub+icmp+branch if possible.Benjamin Kramer2011-02-021-0/+32
| | | | | | | | | | | | | | | | | This makes the job of the later optzn passes easier, allowing the vast amount of icmp transforms to chew on it. We transform 840 switches in gcc.c, leading to a 16k byte shrink of the resulting binary on i386-linux. The testcase from README.txt now compiles into decl %edi cmpl $3, %edi sbbl %eax, %eax andl $1, %eax ret llvm-svn: 124724
* Remove wasteful caching. This isn't needed for correctness because any functionNick Lewycky2011-02-021-23/+2
| | | | | | | | that might have changed been affected by a merge elsewhere will have been removed from the function set, and it isn't needed for performance because we call grow() ahead of time to prevent reallocations. llvm-svn: 124717
* Conservatively, clear optional flags, such as nsw, when performingDan Gohman2011-02-021-0/+15
| | | | | | | reassociation. No testcase, because I wasn't able to create a testcase which actually demonstrates a problem. llvm-svn: 124713
* Fix reassociate to clear optional flags, such as nsw.Dan Gohman2011-02-021-0/+16
| | | | llvm-svn: 124712
* Recognize and simplifyAnders Carlsson2011-01-301-1/+11
| | | | | | | (A+B) == A -> B == 0 A == (A+B) -> B == 0 llvm-svn: 124567
* Unbreak the MSVC build.Francois Pichet2011-01-291-0/+1
| | | | | | The DEBUG() call at line 606 demands to see raw_ostream's definition. I have no idea why this seems to only break MSVC. llvm-svn: 124545
* Call SimplifyFDivInst() in InstCombiner::visitFDiv().Frits van Bommel2011-01-292-0/+10
| | | | llvm-svn: 124535
* Move InstCombine's knowledge of fdiv to SimplifyInstruction().Frits van Bommel2011-01-292-15/+0
| | | | llvm-svn: 124534
* Add a test for TCE return duplication.Evan Cheng2011-01-291-0/+2
| | | | llvm-svn: 124527
* Re-apply r124518 with fix. Watch out for invalidated iterator.Evan Cheng2011-01-293-40/+143
| | | | llvm-svn: 124526
* Revert r124518. It broke Linux self-host.Evan Cheng2011-01-293-140/+40
| | | | llvm-svn: 124522
* Re-commit r124462 with fixes. Tail recursion elim will now dup ret into ↵Evan Cheng2011-01-293-40/+140
| | | | | | unconditional predecessor to enable TCE on demand. llvm-svn: 124518
* Implementation of path profiling.Andrew Trick2011-01-297-17/+1448
| | | | | | | | | | Modified patch by Adam Preuss. This builds on the existing framework for block tracing, edge profiling and optimal edge profiling. See -help-hidden for new flags. For documentation, see the technical report "Implementation of Path Profiling..." in llvm.org/pubs. llvm-svn: 124515
* My auto-simplifier noticed that ((X/Y)*Y)/Y occurs several times in SPECDuncan Sands2011-01-281-56/+24
| | | | | | | | | | | | | | | | | benchmarks, and that it can be simplified to X/Y. (In general you can only simplify (Z*Y)/Y to Z if the multiplication did not overflow; if Z has the form "X/Y" then this is the case). This patch implements that transform and moves some Div logic out of instcombine and into InstructionSimplify. Unfortunately instcombine gets in the way somewhat, since it likes to change (X/Y)*Y into X-(X rem Y), so I had to teach instcombine about this too. Finally, thanks to the NSW/NUW flags, sometimes we know directly that "Z*Y" does not overflow, because the flag says so, so I added that logic too. This eliminates a bunch of divisions and subtractions in 447.dealII, and has good effects on some other benchmarks too. It seems to have quite an effect on tramp3d-v4 but it's hard to say if it's good or bad because inlining decisions changed, resulting in massive changes all over. llvm-svn: 124487
* Rename functions to follow coding standard. Also rejiggers comments. NoNick Lewycky2011-01-281-89/+88
| | | | | | functionality change. llvm-svn: 124482
* Add a doxygen comment for this class.Nick Lewycky2011-01-281-0/+2
| | | | llvm-svn: 124480
* Reorder for readability. (Chris, is this what you meant?)Nick Lewycky2011-01-281-148/+150
| | | | llvm-svn: 124479
* Revert r124462. There are a few big regressions that I need to fix first.Evan Cheng2011-01-281-6/+1
| | | | llvm-svn: 124478
* Reduce the number of functions we look at in the first pass, and preallocateNick Lewycky2011-01-281-1/+3
| | | | | | the function equality set. llvm-svn: 124475
* Fold select + select where both selects are on the same condition.Nick Lewycky2011-01-281-0/+13
| | | | llvm-svn: 124469
* - Stop simplifycfg from duplicating "ret" instructions into unconditionalEvan Cheng2011-01-281-1/+6
| | | | | | | | branches. PR8575, rdar://5134905, rdar://8911460. - Allow codegen tail duplication to dup small return blocks after register allocation is done. llvm-svn: 124462
* Unbreak the build.Benjamin Kramer2011-01-271-1/+1
| | | | llvm-svn: 124426
* Expound upon this comparison!Nick Lewycky2011-01-271-0/+2
| | | | llvm-svn: 124406
* Use dyn_cast instead of isa+cast.Nick Lewycky2011-01-271-2/+1
| | | | llvm-svn: 124404
* Fix surprising missed optimization in mergefunc where we forgot to considerNick Lewycky2011-01-271-3/+12
| | | | | | that relationships like "i8* null" is equivalent to "i32* null". llvm-svn: 124368
* Fix PR9039, a use-after-free in reassociate. The issue was that theDuncan Sands2011-01-261-4/+11
| | | | | | | | operand being factorized (and erased) could occur several times in Ops, resulting in freed memory being used when the next occurrence in Ops was analyzed. llvm-svn: 124287
* AttrListPtr has an overloaded operator== which does this for us, we should useNick Lewycky2011-01-261-4/+2
| | | | | | it. No functionality change! llvm-svn: 124286
* Teach mergefunc that intptr_t is the same width as a pointer. We still can'tNick Lewycky2011-01-261-1/+7
| | | | | | | merge vector<intptr_t>::push_back() and vector<void*>::push_back() because Enumerate() doesn't realize that "i64* null" and "i8** null" are equivalent. llvm-svn: 124285
* There are no vectors of pointer or arrays, so we don't need to check vectorNick Lewycky2011-01-261-7/+1
| | | | | | elements for type equivalence. llvm-svn: 124284
* Teach mergefunc how to emit aliases safely again -- but keep it turned it offNick Lewycky2011-01-251-25/+79
| | | | | | | for now. It's controlled by the HasGlobalAliases variable which is not attached to any flag yet. llvm-svn: 124182
* Give GetUnderlyingObject a TargetData, to keep it in syncDan Gohman2011-01-243-5/+6
| | | | | | | | | | | with BasicAA's DecomposeGEPExpression, which recently began using a TargetData. This fixes PR8968, though the testcase is awkward to reduce. Also, update several off GetUnderlyingObject's users which happen to have a TargetData handy to pass it in. llvm-svn: 124134
* fix PR9017, a bug where we'd assert when promoting in unreachableChris Lattner2011-01-241-0/+3
| | | | | | code. llvm-svn: 124100
* fix PR9015, a crash linking recursive metadata.Chris Lattner2011-01-241-6/+11
| | | | llvm-svn: 124099
* enhance SRoA to promote allocas that are used by PHI nodes. This oftenChris Lattner2011-01-241-26/+157
| | | | | | | | | | occurs because instcombine sinks loads and inserts phis. This kicks in on such apps as 175.vpr, eon, 403.gcc, xalancbmk and a bunch of times in spec2006 in some app that uses std::deque. This resolves the last of rdar://7339113. llvm-svn: 124090
* Enhance SRoA to promote allocas that are used by selects in someChris Lattner2011-01-231-1/+132
| | | | | | | | | | | | | | | | | | | | common cases. This triggers a surprising number of times in SPEC2K6 because min/max idioms end up doing this. For example, code from the STL ends up looking like this to SRoA: %202 = load i64* %__old_size, align 8, !tbaa !3 %203 = load i64* %__old_size, align 8, !tbaa !3 %204 = load i64* %__n, align 8, !tbaa !3 %205 = icmp ult i64 %203, %204 %storemerge.i = select i1 %205, i64* %__n, i64* %__old_size %206 = load i64* %storemerge.i, align 8, !tbaa !3 We can now promote both the __n and the __old_size allocas. This addresses another chunk of rdar://7339113, poor codegen on stringswitch. llvm-svn: 124088
* Null initialize a few variables flagged byTed Kremenek2011-01-231-1/+1
| | | | | | | | | | clang's -Wuninitialized-experimental warning. While these don't look like real bugs, clang's -Wuninitialized-experimental analysis is stricter than GCC's, and these fixes have the benefit of being general nice cleanups. llvm-svn: 124073
* Enhance SRoA to be more aggressive about scalarization of aggregate allocasChris Lattner2011-01-231-12/+114
| | | | | | | | | | | | that have PHI or select uses of their element pointers. This can often happen when instcombine sinks two loads into a successor, inserting a phi or select. With this patch, we can scalarize the alloca, but the pinned elements are not yet promoted. This is still a win for large aggregates where only one element is used. This fixes rdar://8904039 and part of rdar://7339113 (poor codegen on stringswitch). llvm-svn: 124070
* Convert two std::vectors to SmallVectors for a 3.4% speedup running -scalarreplCameron Zwarich2011-01-231-2/+2
| | | | | | on test-suite + SPEC2000 & SPEC2006. llvm-svn: 124068
* have AllocaInfo store the alloca being inspected, simplifying callers.Chris Lattner2011-01-231-22/+24
| | | | | | No functionality change. llvm-svn: 124067
* Rearrange some code a bit. Change MarkUnsafe to Chris Lattner2011-01-231-27/+29
| | | | | | | | handle the "Transformation preventing inst" printing, so that -scalarrepl -debug will always print the rejected instruction. No functionality change. llvm-svn: 124066
* remove an old hack that avoided creating MMX datatypes. TheChris Lattner2011-01-231-22/+1
| | | | | | X86 backend has been fixed. llvm-svn: 124064
* Actually check memcpy lengths, instead of just commenting aboutDan Gohman2011-01-211-2/+4
| | | | | | how they should be checked. llvm-svn: 123999
* Just because we have determined that an (fcmp | fcmp) is true for A < B,Owen Anderson2011-01-211-1/+3
| | | | | | | A == B, and A > B, does not mean we can fold it to true. We still need to check for A ? B (A unordered B). llvm-svn: 123993
OpenPOWER on IntegriCloud