summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Refine the change in r52258 for avoiding use-before-def conditionsDan Gohman2008-06-161-9/+12
| | | | | | | | | when changing the stride of a comparison so that it's slightly more precise, by having it scan the instruction list to determine if there is a use of the condition after the point where the condition will be inserted. llvm-svn: 52371
* Switch over to SetVector to ensure same order of iterations do not vary ↵Evan Cheng2008-06-161-8/+9
| | | | | | across runs. llvm-svn: 52361
* Iterating over SmallPtrSet is not deterministic.Evan Cheng2008-06-161-6/+6
| | | | llvm-svn: 52339
* Pass around Instruction* instead of Instruction& in FindInsertedValue and ↵Matthijs Kooijman2008-06-161-1/+1
| | | | | | friends. llvm-svn: 52318
* 80 column fixes.Matthijs Kooijman2008-06-161-1/+2
| | | | llvm-svn: 52316
* Move FindScalarValue from InstructionCombining.cpp to ValueTracking.cpp. WhileMatthijs Kooijman2008-06-161-147/+1
| | | | | | | | | | I'm at it, rename it to FindInsertedValue. The only functional change is that newly created instructions are no longer added to instcombine's worklist, but that is not really necessary anyway (and I'll commit some improvements next that will completely remove the need). llvm-svn: 52315
* Fix the crash on SimplifyLibCalls/2005-05-20-sprintf-crash.llChris Lattner2008-06-161-1/+1
| | | | llvm-svn: 52295
* Fix a case where tailcallelim wouldn't set the changed bit when it made a ↵Chris Lattner2008-06-141-1/+3
| | | | | | change. llvm-svn: 52267
* Don't skip over instructions other than loads that might read memory Eli Friedman2008-06-131-5/+6
| | | | | | when trying to sink stores. llvm-svn: 52259
* Protect ChangeCompareStride from situations in which it is possibleDan Gohman2008-06-131-3/+12
| | | | | | for it to generate use-before-def IR, such as in this testcase. llvm-svn: 52258
* Make sure SimplifyStoreAtEndOfBlock doesn't mess with loops; the Eli Friedman2008-06-131-2/+6
| | | | | | | structure checks are incorrect if the blocks aren't distinct. Fixes PR2435. llvm-svn: 52257
* Use recently added getTruncateOrZeroExtend method to make the code shorter.Wojciech Matyjewicz2008-06-131-5/+1
| | | | llvm-svn: 52251
* fix a minor deviation from the original in my previous commitGabor Greif2008-06-121-1/+1
| | | | llvm-svn: 52247
* op_iterator-ify some loops, low hanging fruit only, there is moreGabor Greif2008-06-121-19/+21
| | | | llvm-svn: 52246
* Do not speculatively execute an instruction by hoisting it to its ↵Evan Cheng2008-06-121-2/+16
| | | | | | predecessor BB if any of its operands are defined but not used in BB. The transformation will prevent the operand from being sunk into the use block. llvm-svn: 52244
* Revert 52223.Evan Cheng2008-06-121-18/+0
| | | | llvm-svn: 52243
* Switch GVN to use ScopedHashTable.Owen Anderson2008-06-121-134/+64
| | | | llvm-svn: 52242
* op_iterator-ify some loops, fix 80col violationsGabor Greif2008-06-111-9/+11
| | | | llvm-svn: 52226
* For now, avoid generating FP select instructions in order to speculatively ↵Evan Cheng2008-06-111-4/+9
| | | | | | | | execute integer arithmetic instructions. FP selects are more likely to be expensive (even compared to branch on fcmp). This is not a wonderful solution but I rather err on the side of conservative. This fixes the heapsort performance regressions. llvm-svn: 52224
* Avoid duplicating loop header which leads to unnatural loops (and just seem ↵Evan Cheng2008-06-111-0/+18
| | | | | | | | like general badness to me, likely to cause code explosion). Patch by Florian Brandner. llvm-svn: 52223
* Teach instruction combining about the extractvalue. It can succesfully foldMatthijs Kooijman2008-06-111-0/+157
| | | | | | | | useless insert-extract chains, similar to how it folds them for vectors. Add a testcase for this. llvm-svn: 52217
* Clarify a comment.Matthijs Kooijman2008-06-111-3/+3
| | | | llvm-svn: 52212
* op_iterator-ify loopsGabor Greif2008-06-101-13/+16
| | | | llvm-svn: 52191
* lower calls to abs to inline code, PR2337Chris Lattner2008-06-091-1/+26
| | | | llvm-svn: 52138
* Fix PR2411, where ip constant prop would propagate theChris Lattner2008-06-091-0/+5
| | | | | | result of a weak function. llvm-svn: 52137
* Remove comparison methods for MVT. The main causeDuncan Sands2008-06-081-2/+2
| | | | | | | | | | | of apint codegen failure is the DAG combiner doing the wrong thing because it was comparing MVT's using < rather than comparing the number of bits. Removing the < method makes this mistake impossible to commit. Instead, add helper methods for comparing bits and use them. llvm-svn: 52098
* Limit the icmp+phi merging optimization to the cases where it is profitable:Chris Lattner2008-06-081-4/+12
| | | | | | don't make i1 phis when it won't be possible to eliminate them. llvm-svn: 52097
* Speculatively execute a block when the the block is the then part of a ↵Evan Cheng2008-06-071-0/+121
| | | | | | | | | | | | | | | | | | | | triangle shape and it contains a single, side effect free, cheap instruction. The branch is eliminated by adding a select instruction. i.e. Turn BB: %t1 = icmp br i1 %t1, label %BB1, label %BB2 BB1: %t3 = add %t2, c br label BB2 BB2: => BB: %t1 = icmp %t4 = add %t2, c %t3 = select i1 %t1, %t2, %t3 llvm-svn: 52073
* LoopSimplify preserves AA.Devang Patel2008-06-061-3/+5
| | | | llvm-svn: 52053
* Wrap MVT::ValueType in a struct to get type safetyDuncan Sands2008-06-061-3/+3
| | | | | | | | | | | | | | | | and better control the abstraction. Rename the type to MVT. To update out-of-tree patches, the main thing to do is to rename MVT::ValueType to MVT, and rewrite expressions like MVT::getSizeInBits(VT) in the form VT.getSizeInBits(). Use VT.getSimpleVT() to extract a MVT::SimpleValueType for use in switch statements (you will get an assert failure if VT is an extended value type - these shouldn't exist after type legalization). This results in a small speedup of codegen and no new testsuite failures (x86-64 linux). llvm-svn: 52044
* As Chris suggested, handle the situation if ShAmt larger than BitWidth, Zhou Sheng2008-06-061-1/+1
| | | | | | otherwise, opt might crash. llvm-svn: 52041
* If BitWidth equals to ShtAmt, the RHSKnownZero[BitWidth-ShiftAmt-1] willZhou Sheng2008-06-051-1/+1
| | | | | | | | crash the opt. Just fix this. Test case in llvm/test/Transforms/InstCombine/2008-06-05-ashr-crash.ll llvm-svn: 52003
* Learn ScalarReplAggregrates how stores and loads of first class aggregratesMatthijs Kooijman2008-06-051-0/+51
| | | | | | | | | | work and how to replace them into individual values. Also, when trying to replace an aggregrate that is used by load or store with a single (large) integer, don't crash (but don't replace the aggregrate either). Also adds a testcase for both structs and arrays. llvm-svn: 51997
* Let StructRetPromotion check if all if its users are really calls or invokesn,Matthijs Kooijman2008-06-051-0/+4
| | | | | | not other instructions. This fixes a crash with the added testcase. llvm-svn: 51992
* Let StructRetPromotion check if it's users are really calling it and notMatthijs Kooijman2008-06-051-0/+4
| | | | | | passing its pointer. Fixes test with added testcase. llvm-svn: 51991
* Use use_iterator::getOperandNo instead of CallSite::hasArgument to check if aMatthijs Kooijman2008-06-051-7/+6
| | | | | | | function is passed as an argument instead of called. Also do this check a bit earlier. llvm-svn: 51990
* Update comments and documentation to reflect that GCSE and ValueNumbering areMatthijs Kooijman2008-06-053-1/+10
| | | | | | deprecated by the GVN and GVNPRE passes. llvm-svn: 51983
* Remove unneeded #include.Owen Anderson2008-06-041-1/+0
| | | | llvm-svn: 51955
* Replace two manual loops with calls to CallSite::hasArguments (no functional ↵Matthijs Kooijman2008-06-041-7/+5
| | | | | | changes). llvm-svn: 51947
* Change packed struct layout so that field sizesDuncan Sands2008-06-041-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | are the same as in unpacked structs, only field positions differ. This only matters for structs containing x86 long double or an apint; it may cause backwards compatibility problems if someone has bitcode containing a packed struct with a field of one of those types. The issue is that only 10 bytes are needed to hold an x86 long double: the store size is 10 bytes, but the ABI size is 12 or 16 bytes (linux/ darwin) which comes from rounding the store size up by the alignment. Because it seemed silly not to pack an x86 long double into 10 bytes in a packed struct, this is what was done. I now think this was a mistake. Reserving the ABI size for an x86 long double field even in a packed struct makes things more uniform: the ABI size is now always used when reserving space for a type. This means that developers are less likely to make mistakes. It also makes life easier for the CBE which otherwise could not represent all LLVM packed structs (PR2402). Front-end people might need to adjust the way they create LLVM structs - see following change to llvm-gcc. llvm-svn: 51928
* LoopIndexSplit can sometimes result in cases where a block in its own ↵Owen Anderson2008-06-031-3/+6
| | | | | | | | domfrontier. Don't crash when we encounter one of these. llvm-svn: 51915
* Fix whitespace in whitespace-significant pseudocode in a comment.Dan Gohman2008-06-031-2/+2
| | | | llvm-svn: 51890
* Update dom tree. Fix PR 2372.Devang Patel2008-06-021-1/+4
| | | | llvm-svn: 51887
* move CannotBeNegativeZero to ValueTracking. Simplify some signbit comparisons.Chris Lattner2008-06-021-54/+2
| | | | llvm-svn: 51864
* move ComputeMaskedBits, MaskedValueIsZero, and ComputeNumSignBitsChris Lattner2008-06-021-651/+14
| | | | | | | out of instcombine into a new file in libanalysis. This also teaches ComputeNumSignBits about the number of sign bits in a constantint. llvm-svn: 51863
* Fix two issues that Eli Friedman pointed out, where would misoptimized code ↵Owen Anderson2008-06-011-3/+14
| | | | | | | | | | | | | | | | like: char a[200]; init(a, a+200); OR int a[200]; char* b = (char*)a; char* c = (char*)a; foo(b, c); llvm-svn: 51850
* Don't remove the memcpy when call slot substitution fails.Owen Anderson2008-06-011-0/+5
| | | | llvm-svn: 51848
* When simplifying a call to a bitcast function, tighten upDuncan Sands2008-06-011-18/+15
| | | | | | | | | | | | | | | | | | | | the conditions for performing the transform when only the function declaration is available: no longer allow turning i32 into i64 for example. Only allow changing between pointer types, and between pointer types and integers of the same size. For return values ptr -> intptr was already allowed; I added ptr -> ptr and intptr -> ptr while there. As shown by a recent objc testcase, changing the way parameters/return values are passed can be fatal when calling code written in assembler that directly manipulates call arguments and return values unless the transform has no impact on the way they are passed at the codegen level. While it is possible to imagine an ABI that treats integers of pointer size differently to pointers, I don't think LLVM supports any so the transform should now be safe while still being useful. llvm-svn: 51834
* Peer through sext/zext when looking for not(cmp).Nick Lewycky2008-05-311-0/+20
| | | | llvm-svn: 51819
* Add more i1 optimizations. add, sub, mul, s/udiv on i1 are now simplified away.Nick Lewycky2008-05-311-5/+15
| | | | llvm-svn: 51817
OpenPOWER on IntegriCloud