aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Make sure that ConstantExpr offsets also aren't off of externEric Christopher2010-02-111-2/+8
| | | | | | | | | symbols. Thanks to Duncan Sands for the testcase! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95877 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename ValueRequiresCast to ShouldOptimizeCast, to better reflectChris Lattner2010-02-113-55/+97
| | | | | | | | | | | | | | | what it does. Enhance it to return false to optimizing vector sign extensions from vector comparisions, which is the idiom used to get a splatted vector for a vector comparison. Doing this breaks vector-casts.ll, add some compensating transformations to handle the important case they cover without depending on this canonicalization. This fixes rdar://7434900 a serious pessimization of vector compares. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95855 91177308-0d34-0410-b5e6-96231b3b80d8
* Make DSE only scan blocks that are reachable from the entryChris Lattner2010-02-111-1/+7
| | | | | | | | | | block. Other blocks may have pointer cycles that will crash basicaa and other alias analyses. In any case, there is no point wasting cycles optimizing dead blocks. This fixes rdar://7635088 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95852 91177308-0d34-0410-b5e6-96231b3b80d8
* Make jump threading honor x|undef -> true and x&undef -> false,Chris Lattner2010-02-111-3/+8
| | | | | | | instead of considering x|undef -> x, which may not be true. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95850 91177308-0d34-0410-b5e6-96231b3b80d8
* Add ConstantExpr handling to Intrinsic::objectsize lowering.Eric Christopher2010-02-111-1/+26
| | | | | | | | Update testcase accordingly now that we can optimize another section. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95846 91177308-0d34-0410-b5e6-96231b3b80d8
* Ignore dbg info intrinsics.Devang Patel2010-02-111-0/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95828 91177308-0d34-0410-b5e6-96231b3b80d8
* Strip new llvm.dbg.value intrinsic.Devang Patel2010-02-101-0/+9
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95807 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix "the the" and similar typos.Dan Gohman2010-02-106-8/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95781 91177308-0d34-0410-b5e6-96231b3b80d8
* Move Intrinsic::objectsize lowering back to InstCombineCalls andEric Christopher2010-02-091-1/+19
| | | | | | | enable constant 0 offset lowering. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95691 91177308-0d34-0410-b5e6-96231b3b80d8
* Pull these back out, they're a little too aggressive and timeEric Christopher2010-02-092-115/+0
| | | | | | | consuming for a simple optimization. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95671 91177308-0d34-0410-b5e6-96231b3b80d8
* simplify this code, duh.Chris Lattner2010-02-091-8/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95643 91177308-0d34-0410-b5e6-96231b3b80d8
* fix PR6193, only considering sign extensions *from i1* for thisChris Lattner2010-02-091-5/+10
| | | | | | | xform. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95642 91177308-0d34-0410-b5e6-96231b3b80d8
* Add file in here too.Eric Christopher2010-02-091-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95641 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a new pass to do llvm.objsize lowering using SCEV.Eric Christopher2010-02-091-0/+114
| | | | | | | | | | | | | Initial skeleton and SCEVUnknown lowering implemented, the rest should come relatively quickly. Move testcase to new directory. Move pass to right before SimplifyLibCalls - which is moved down a bit so we can take advantage of a few opts. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95628 91177308-0d34-0410-b5e6-96231b3b80d8
* fix some problems handling large vectors reported in PR6230Chris Lattner2010-02-082-9/+14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95616 91177308-0d34-0410-b5e6-96231b3b80d8
* Reintroduce the InlineHint function attribute.Jakob Stoklund Olesen2010-02-061-7/+24
| | | | | | | | | | | | This time it's for real! I am going to hook this up in the frontends as well. The inliner has some experimental heuristics for dealing with the inline hint. When given a -respect-inlinehint option, functions marked with the inline keyword are given a threshold just above the default for -O3. We need some experiments to determine if that is the right thing to do. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95466 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't unroll loops containing function calls.Jakob Stoklund Olesen2010-02-051-2/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95454 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach SimplifyCFG about magic pointer constants.Jakob Stoklund Olesen2010-02-052-40/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Weird code sometimes uses pointer constants other than null. This patch teaches SimplifyCFG to build switch instructions in those cases. Code like this: void f(const char *x) { if (!x) puts("null"); else if ((uintptr_t)x == 1) puts("one"); else if (x == (char*)2 || x == (char*)3) puts("two"); else if ((intptr_t)x == 4) puts("four"); else puts(x); } Now becomes a switch: define void @f(i8* %x) nounwind ssp { entry: %magicptr23 = ptrtoint i8* %x to i64 ; <i64> [#uses=1] switch i64 %magicptr23, label %if.else16 [ i64 0, label %if.then i64 1, label %if.then2 i64 2, label %if.then9 i64 3, label %if.then9 i64 4, label %if.then14 ] Note that LLVM's own DenseMap uses magic pointers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95439 91177308-0d34-0410-b5e6-96231b3b80d8
* fix logical-select to invoke filecheck right, and fix hte instcombineChris Lattner2010-02-051-1/+6
| | | | | | | | | | | xform it is checking to actually pass. There is no need to match m_SelectCst<0, -1> since instcombine canonicalizes that into not(sext). Add matches for sext(not(x)) in addition to not(sext(x)). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95420 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement releaseMemory in CodeGenPrepare and free the BackEdgesDan Gohman2010-02-051-0/+4
| | | | | | | | container data. This prevents it from holding onto dangling pointers and potentially behaving unpredictably. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95409 91177308-0d34-0410-b5e6-96231b3b80d8
* Use a SmallSetVector instead of a SetVector; this code showed up as aDan Gohman2010-02-051-2/+3
| | | | | | | malloc caller in a profile. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95407 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove this code for now. I have a better idea and will rewrite withEric Christopher2010-02-051-41/+0
| | | | | | | that in mind. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95402 91177308-0d34-0410-b5e6-96231b3b80d8
* Do not reassociate expressions with i1 type. SimplifyCFG converts someBob Wilson2010-02-041-0/+9
| | | | | | | | | | | short-circuited conditions to AND/OR expressions, and those expressions are often converted back to a short-circuited form in code gen. The original source order may have been optimized to take advantage of the expected values, and if we reassociate them, we change the order and subvert that optimization. Radar 7497329. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95333 91177308-0d34-0410-b5e6-96231b3b80d8
* Increase inliner thresholds by 25.Jakob Stoklund Olesen2010-02-041-3/+3
| | | | | | | | This makes the inliner about as agressive as it was before my changes to the inliner cost calculations. These levels give the same performance and slightly smaller code than before. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95320 91177308-0d34-0410-b5e6-96231b3b80d8
* Temporarily revert this since it appears to have caused a buildEric Christopher2010-02-041-49/+23
| | | | | | | failure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95294 91177308-0d34-0410-b5e6-96231b3b80d8
* Rework constant expr and array handling for objectsize instcombining.Eric Christopher2010-02-041-23/+49
| | | | | | | | | | | Fix bugs where we would compute out of bounds as in bounds, and where we couldn't know that the linker could override the size of an array. Add a few new testcases, change existing testcase to use a private global array instead of extern. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95283 91177308-0d34-0410-b5e6-96231b3b80d8
* If we're dealing with a zero-length array, don't lower to anyEric Christopher2010-02-031-4/+9
| | | | | | | particular size, we just don't know what the length is yet. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95266 91177308-0d34-0410-b5e6-96231b3b80d8
* Adjust the heuristics used to decide when SROA is likely to be profitable.Bob Wilson2010-02-031-18/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SRThreshold value makes perfect sense for checking if an entire aggregate should be promoted to a scalar integer, but it is not so good for splitting an aggregate into its separate elements. A struct may contain a large embedded array along with some scalar fields that would benefit from being split apart by SROA. Even if the total aggregate size is large, it may still be good to perform SROA. Thus, the most important piece of this patch is simply moving the aggregate size comparison vs. SRThreshold so that it guards only the aggregate promotion. We have also been checking the number of elements to decide if an aggregate should be split up. The limit of "SRThreshold/4" seemed rather arbitrary, and I don't think it's very useful to derive this limit from SRThreshold anyway. I've collected some data showing that the current default limit of 32 (since SRThreshold defaults to 128) is a reasonable cutoff for struct types. One thing suggested by the data is that distinguishing between structs and arrays might be useful. There are (obviously) a lot more large arrays than large structs (as measured by the number of elements and not the total size -- a large array inside a struct still counts as a single element given the way we do SROA right now). Out of 8377 arrays where we successfully performed SROA while compiling a large set of benchmarks, only 16 of them had more than 8 elements. And, for those 16 arrays, it's not at all clear that SROA was actually beneficial. So, to offset the compile time cost of investigating more large structs for SROA, the patch lowers the limit on array elements to 8. This fixes Apple Radar 7563690. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95224 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 94937 and move the noreturn check to codegen.Evan Cheng2010-02-031-5/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95198 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some comment typos.Bob Wilson2010-02-031-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95170 91177308-0d34-0410-b5e6-96231b3b80d8
* Recommit this, looks like it wasn't the cause.Eric Christopher2010-02-032-70/+100
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95165 91177308-0d34-0410-b5e6-96231b3b80d8
* Hopefully temporarily revert this.Eric Christopher2010-02-022-100/+70
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95154 91177308-0d34-0410-b5e6-96231b3b80d8
* Reformat my last patch slightly.Eric Christopher2010-02-021-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95147 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-add strcmp and known size object size checking optimization.Eric Christopher2010-02-022-12/+41
| | | | | | | Passed bootstrap and nightly test run here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95145 91177308-0d34-0410-b5e6-96231b3b80d8
* don't turn (A & (C0?-1:0)) | (B & ~(C0?-1:0)) -> C0 ? A : BChris Lattner2010-02-021-9/+13
| | | | | | | | for vectors. Codegen is generating awful code or segfaulting in various cases (e.g. PR6204). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95058 91177308-0d34-0410-b5e6-96231b3b80d8
* fix a crash in loop unswitch on a loop invariant vector condition.Chris Lattner2010-02-021-1/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95055 91177308-0d34-0410-b5e6-96231b3b80d8
* LangRef.html says that inttoptr and ptrtoint always use zero-extensionDan Gohman2010-02-021-21/+32
| | | | | | | when the cast is extending. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95046 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't need to check the last argument since it'll always be bool. We alsoEric Christopher2010-02-021-5/+1
| | | | | | | don't use TargetData here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95040 91177308-0d34-0410-b5e6-96231b3b80d8
* More indentation/tabification fixes.Eric Christopher2010-02-021-13/+13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95036 91177308-0d34-0410-b5e6-96231b3b80d8
* Untabify previous commit.Eric Christopher2010-02-021-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95035 91177308-0d34-0410-b5e6-96231b3b80d8
* Formatting.Eric Christopher2010-02-011-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95027 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an option to GVN to remove all partially redundant loads. This is currentlyBob Wilson2010-02-011-80/+107
| | | | | | | | | | disabled by default. This divides the existing load PRE code into 2 phases: first it checks that it is safe to move the load to each of the predecessors where it is unavailable, and then if it is safe, the code is changed to move the load. Radar 7571861. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95007 91177308-0d34-0410-b5e6-96231b3b80d8
* cleanups.Chris Lattner2010-02-011-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94995 91177308-0d34-0410-b5e6-96231b3b80d8
* fix rdar://7590304, a miscompilation of objc apps on arm. The callerChris Lattner2010-02-011-3/+7
| | | | | | | | | | of objc message send was getting marked arm_apcscc, but the prototype isn't. This is fine at runtime because objcmsgsend is implemented in assembly. Only turn a mismatched caller and callee into 'unreachable' if the callee is a definition. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94986 91177308-0d34-0410-b5e6-96231b3b80d8
* fix rdar://7590304, an infinite loop in instcombine. In the invokeChris Lattner2010-02-011-1/+6
| | | | | | | | | | | | | | case, instcombine can't zap the invoke for fear of changing the CFG. However, we have to do something to prevent the next iteration of instcombine from inserting another store -> undef before the invoke thereby getting into infinite iteration between dead store elim and store insertion. Just zap the callee to null, which will prevent the next iteration from doing anything. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94985 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix pr6198 by moving the isSized() check to an outer conditional.Bob Wilson2010-02-011-6/+8
| | | | | | | | The testcase from pr6198 does not crash for me -- I don't know what's up with that -- so I'm not adding it to the tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94984 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify/generalize the xor+add->sign-extend instcombine.Eli Friedman2010-01-311-35/+19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94943 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a small transform: transform -(X<<Y) to (-X<<Y) when the shift has a singleEli Friedman2010-01-311-0/+7
| | | | | | | | use and X is free to negate. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94941 91177308-0d34-0410-b5e6-96231b3b80d8
* Do not mark no-return calls tail calls. It'll screw up special calls like ↵Evan Cheng2010-01-311-4/+5
| | | | | | longjmp and it doesn't make much sense for performance reason. If my logic is faulty, please let me know. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94937 91177308-0d34-0410-b5e6-96231b3b80d8
* Check alignment of loads when deciding whether it is safe to execute themBob Wilson2010-01-304-15/+25
| | | | | | | | unconditionally. Besides checking the offset, also check that the underlying object is aligned as much as the load itself. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94875 91177308-0d34-0410-b5e6-96231b3b80d8