summaryrefslogtreecommitdiff
path: root/lib/Transforms
Commit message (Collapse)AuthorAge
* LSR should avoid redundant edge splitting.Andrew Trick2011-10-04
| | | | | | | | | This handles the case in which LSR rewrites an IV user that is a phi and splits critical edges originating from a switch. Fixes <rdar://problem/6453893> LSR is not splitting edges "nicely" git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141059 91177308-0d34-0410-b5e6-96231b3b80d8
* whitespaceAndrew Trick2011-10-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141058 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a new icmp+select optz'n. Also shows off the load(cst) folding added inNick Lewycky2011-10-02
| | | | | | | r140966. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140969 91177308-0d34-0410-b5e6-96231b3b80d8
* Enhance a couple places where we were doing constant folding of instructions,Nick Lewycky2011-10-02
| | | | | | | but not load instructions. Noticed by inspection. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140966 91177308-0d34-0410-b5e6-96231b3b80d8
* Inlining and unrolling heuristics should be aware of free truncs.Andrew Trick2011-10-01
| | | | | | | | | | | We want heuristics to be based on accurate data, but more importantly we don't want llvm to behave randomly. A benign trunc inserted by an upstream pass should not cause a wild swings in optimization level. See PR11034. It's a general problem with threshold-based heuristics, but we can make it less bad. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140919 91177308-0d34-0410-b5e6-96231b3b80d8
* whitespaceAndrew Trick2011-10-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140916 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't modify constant in-place.Jim Grosbach2011-09-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140875 91177308-0d34-0410-b5e6-96231b3b80d8
* float comparison to double 'zero' constant can just be a float 'zero.'Jim Grosbach2011-09-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | InstCombine was incorrectly considering the conversion of the constant zero to be unsafe. We want to transform: define float @bar(float %x) nounwind readnone optsize ssp { %conv = fpext float %x to double %cmp = fcmp olt double %conv, 0.000000e+00 %conv1 = zext i1 %cmp to i32 %conv2 = sitofp i32 %conv1 to float ret float %conv2 } Into: define float @bar(float %x) nounwind readnone optsize ssp { %cmp = fcmp olt float %x, 0.000000e+00 ; <---- This %conv1 = zext i1 %cmp to i32 %conv2 = sitofp i32 %conv1 to float ret float %conv2 } rdar://10215914 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140869 91177308-0d34-0410-b5e6-96231b3b80d8
* Tidy up. Trailing whitespace.Jim Grosbach2011-09-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140865 91177308-0d34-0410-b5e6-96231b3b80d8
* Inlining often produces landingpad instructions with repeatedDuncan Sands2011-09-30
| | | | | | | | | | | | | | | catch or repeated filter clauses. Teach instcombine a bunch of tricks for simplifying landingpad clauses. Currently the code only recognizes the GNU C++ and Ada personality functions, but that doesn't stop it doing a bunch of "generic" transforms which are hopefully fine for any real-world personality function. If these "generic" transforms turn out not to be generic, they can always be conditioned on the personality function. Probably someone should add the ObjC++ personality function. I didn't as I don't know anything about it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140852 91177308-0d34-0410-b5e6-96231b3b80d8
* Fold two identical set lookups into one. No functionality change.Nick Lewycky2011-09-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140821 91177308-0d34-0410-b5e6-96231b3b80d8
* When eliminating unnecessary retain+autorelease on return values,Dan Gohman2011-09-29
| | | | | | | | handle the case where the retain is in a different basic block. rdar://10210274. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140815 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't eliminate objc_retainBlock calls on stack objects if theDan Gohman2011-09-29
| | | | | | | | objc_retainBlock call is potentially responsible for copying the block to the heap to extend its lifetime. rdar://10209613. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140814 91177308-0d34-0410-b5e6-96231b3b80d8
* Clean up uses of switch instructions so they are not dependent on the ↵Eli Friedman2011-09-29
| | | | | | operand ordering. Patch by Stepan Dyatkovskiy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140803 91177308-0d34-0410-b5e6-96231b3b80d8
* typo + pastoAndrew Trick2011-09-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140769 91177308-0d34-0410-b5e6-96231b3b80d8
* LSR: rewrite inner loops only.Andrew Trick2011-09-29
| | | | | | | | | Rewriting the entire loop nest now requires -enable-lsr-nested. See PR11035 for some performance data. A few unit tests specifically test nested LSR, and are now under a flag. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140762 91177308-0d34-0410-b5e6-96231b3b80d8
* indvars should hoist [sz]ext because licm is not rerun.Andrew Trick2011-09-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140670 91177308-0d34-0410-b5e6-96231b3b80d8
* Stop emitting instructions with the name "tmp" they eat up memory and have ↵Benjamin Kramer2011-09-27
| | | | | | | | to be uniqued, without any benefit. If someone prefers %tmp42 to %42, run instnamer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140634 91177308-0d34-0410-b5e6-96231b3b80d8
* Split the landing pad basic block with the correct function. Also merge theBill Wendling2011-09-27
| | | | | | | | split landingpad instructions into a PHI node. PR11016 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140592 91177308-0d34-0410-b5e6-96231b3b80d8
* Disable LSR retry by default.Andrew Trick2011-09-27
| | | | | | | | Disabling aggressive LSR saves compilation time, and with the new indvars behavior usually improves performance. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140590 91177308-0d34-0410-b5e6-96231b3b80d8
* LSR, one of the new Cost::isLoser() checks did not get merged in the ↵Andrew Trick2011-09-26
| | | | | | previous checkin. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140583 91177308-0d34-0410-b5e6-96231b3b80d8
* LSR cost metric minor fix and verification.Andrew Trick2011-09-26
| | | | | | | | | The minor bug heuristic was noticed by inspection. I added the isLoser/isValid helpers because they will become more important with subsequent checkins. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140580 91177308-0d34-0410-b5e6-96231b3b80d8
* LSR minor bug fix in RateRegister.Andrew Trick2011-09-23
| | | | | | | | No test case. Noticed by inspection and I doubt it ever affects the outcome of the overall heuristic, let alone final codegen. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140431 91177308-0d34-0410-b5e6-96231b3b80d8
* PR10987: add a missed safety check to isSafePHIToSpeculate in scalarrepl.Eli Friedman2011-09-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140327 91177308-0d34-0410-b5e6-96231b3b80d8
* Make sure IPSCCP never marks a tracked call as overdefined in ↵Eli Friedman2011-09-20
| | | | | | | | | | SCCPSolver::ResolvedUndefsIn. If we do, we can end up in a situation where a function is resolved to return a constant, but the caller is marked overdefined, which confuses the code later. <rdar://problem/9956541> (again). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140210 91177308-0d34-0410-b5e6-96231b3b80d8
* Relax this condition.Bill Wendling2011-09-20
| | | | | | | | Some passes require breaking critical edges before they're called. Don't segfault because of that. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140196 91177308-0d34-0410-b5e6-96231b3b80d8
* Place the check for an exit landing pad where it will be run on both code ↵Bill Wendling2011-09-20
| | | | | | paths through the if-then-else. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140195 91177308-0d34-0410-b5e6-96231b3b80d8
* Omit extracting a loop if one of the exits is a landing pad.Bill Wendling2011-09-20
| | | | | | | | | | The landing pad must accompany the invoke when it's extracted. However, if it does, then the loop isn't properly extracted. I.e., the resulting extraction has a loop in it. The extracted function is then extracted, etc. resulting in an infinite loop. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140193 91177308-0d34-0410-b5e6-96231b3b80d8
* Check the terminator, not the basic block.Bill Wendling2011-09-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140176 91177308-0d34-0410-b5e6-96231b3b80d8
* When extracting a basic block that ends in an 'invoke' instruction, we need toBill Wendling2011-09-20
| | | | | | | | | | | extract its associated landing pad block as well. However, that landing pad block may have more than one predecessor. So split the landing pad block so that individual landing pads have only one predecessor. This type of transformation may produce a false positive with bugpoint. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140173 91177308-0d34-0410-b5e6-96231b3b80d8
* Use ArrayRef instead of an explicit 'const std::vector &'.Bill Wendling2011-09-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140172 91177308-0d34-0410-b5e6-96231b3b80d8
* If simple ownership works then friendship is not required.Devang Patel2011-09-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140169 91177308-0d34-0410-b5e6-96231b3b80d8
* Use ArrayRef instead of 'const std::vector' to pass around the list of basic ↵Bill Wendling2011-09-20
| | | | | | blocks to extract. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140168 91177308-0d34-0410-b5e6-96231b3b80d8
* Update GCOVLines to provide interfaces to write line table and calculate ↵Devang Patel2011-09-20
| | | | | | complete length. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140167 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix comments.Bill Wendling2011-09-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140164 91177308-0d34-0410-b5e6-96231b3b80d8
* Update comment.Devang Patel2011-09-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140156 91177308-0d34-0410-b5e6-96231b3b80d8
* Use StringRef instead of std::string.Devang Patel2011-09-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140154 91177308-0d34-0410-b5e6-96231b3b80d8
* Eliminate unnecessary copy of FileName from GCOVLines. Devang Patel2011-09-20
| | | | | | | GCOVLines is always accessed through a StringMap where the key is FileName. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140151 91177308-0d34-0410-b5e6-96231b3b80d8
* There is no need to write a local utility routine to find subprogram info if ↵Devang Patel2011-09-20
| | | | | | the utility routine is already available in DebugInfo. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140145 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r140083 and r140084 until buildbots can be fixed.Bill Wendling2011-09-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140094 91177308-0d34-0410-b5e6-96231b3b80d8
* If we are extracting a basic block that ends in an invoke call, we must alsoBill Wendling2011-09-19
| | | | | | | | | | | extract the landing pad block. Otherwise, there will be a situation where the invoke's unwind edge lands on a non-landing pad. We also forbid the user from extracting the landing pad block by itself. Again, this is not a valid transformation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140083 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix an infinite loop where a transform in InstCombiner::visitAnd claims a ↵Eli Friedman2011-09-19
| | | | | | | | | | construct is changed when it is not. (See included testcase.) Patch by Xiaoyi Guo. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140072 91177308-0d34-0410-b5e6-96231b3b80d8
* [indvars] Fix PR10946: SCEV cannot handle Vector IVs.Andrew Trick2011-09-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140026 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r139759. Disable IV rewriting by default. See PR10916.Andrew Trick2011-09-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139842 91177308-0d34-0410-b5e6-96231b3b80d8
* Make demanded-elt simplification for shufflevector slightly stronger. ↵Eli Friedman2011-09-15
| | | | | | Spotted by inspection. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139768 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't mark objc_retainBlock as nounwind. It calls user copy constructorsDan Gohman2011-09-14
| | | | | | | which could theoretically throw. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139710 91177308-0d34-0410-b5e6-96231b3b80d8
* objc_retainBlock is not NoModRef because it can update forwarding pointersDan Gohman2011-09-14
| | | | | | | in memory relevant to the optimizer. rdar://10050579. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139708 91177308-0d34-0410-b5e6-96231b3b80d8
* [indvars] Revert r139579 until 401.bzip -arch i386 miscompilation is fixed. ↵Andrew Trick2011-09-13
| | | | | | PR10920. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139583 91177308-0d34-0410-b5e6-96231b3b80d8
* Disable IV rewriting by default. See PR10916.Andrew Trick2011-09-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139579 91177308-0d34-0410-b5e6-96231b3b80d8
* [indvars] Fix bugs in floating point IV range checks noticed by inspection.Andrew Trick2011-09-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139574 91177308-0d34-0410-b5e6-96231b3b80d8