summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* my recent change caused a failure in a bswap testcase, because it changedChris Lattner2007-03-031-48/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the order that instcombine processed instructions in the testcase. The end result is that instcombine finished with: define i16 @test1(i16 %a) { %tmp = zext i16 %a to i32 ; <i32> [#uses=2] %tmp21 = lshr i32 %tmp, 8 ; <i32> [#uses=1] %tmp5 = shl i32 %tmp, 8 ; <i32> [#uses=1] %tmp.upgrd.32 = or i32 %tmp21, %tmp5 ; <i32> [#uses=1] %tmp.upgrd.3 = trunc i32 %tmp.upgrd.32 to i16 ; <i16> [#uses=1] ret i16 %tmp.upgrd.3 } which can't get matched as a bswap. This patch makes instcombine more sophisticated about removing truncating casts, allowing it to turn this into: define i16 @test2(i16 %a) { %tmp211 = lshr i16 %a, 8 %tmp52 = shl i16 %a, 8 %tmp.upgrd.323 = or i16 %tmp211, %tmp52 ret i16 %tmp.upgrd.323 } which then matches as bswap. This fixes bswap.ll and implements InstCombine/cast2.ll:test[12]. This also implements cast elimination of add/sub. llvm-svn: 34870
* add a top-level iteration loop to instcombine. This means that it will neverChris Lattner2007-03-031-4/+21
| | | | | | finish without combining something it is capable of. llvm-svn: 34865
* Fix a significant algorithm problem with the instcombine worklist. removingChris Lattner2007-03-021-54/+70
| | | | | | | | | | a value from the worklist required scanning the entire worklist to remove all entries. We now use a combination map+vector to prevent duplicates from happening and prevent the scan. This speeds up instcombine on a large file from the llvm-gcc bootstrap from 189.7s to 4.84s in a debug build and from 5.04s to 1.37s in a release build. llvm-svn: 34848
* minor cleanupChris Lattner2007-03-021-6/+2
| | | | llvm-svn: 34846
* The 64-bit constructor for ConstantInt changes from int64_t to uint64_t.Reid Spencer2007-03-011-1/+1
| | | | | | | This caused a warning for construction with -1. Avoid the warning by using -1ULL instead. llvm-svn: 34796
* Fix InstCombine/2007-02-23-PhiFoldInfLoop.ll and PR1217Chris Lattner2007-02-241-1/+2
| | | | llvm-svn: 34546
* convert more vectors to smallvectors, 2.8% speedupChris Lattner2007-02-151-3/+3
| | | | llvm-svn: 34333
* change some vectors to smallvectors. This speeds up instcombine on 447.dealIIChris Lattner2007-02-151-3/+3
| | | | | | by 5%. llvm-svn: 34332
* switch an std::set to a SmallPtr set, this speeds up instcombine by 9.5%Chris Lattner2007-02-151-3/+4
| | | | | | on 447.dealII llvm-svn: 34323
* For PR1195:Reid Spencer2007-02-151-31/+31
| | | | | | | Rename PackedType -> VectorType, ConstantPacked -> ConstantVector, and PackedTyID -> VectorTyID. No functional changes. llvm-svn: 34293
* Generalize TargetData strings, to support more interesting forms of data.Chris Lattner2007-02-141-12/+13
| | | | | | Patch by Scott Michel. llvm-svn: 34266
* Eliminate use of ctors that take vectors.Chris Lattner2007-02-131-2/+2
| | | | llvm-svn: 34219
* stop using methods that take vectors.Chris Lattner2007-02-121-1/+2
| | | | llvm-svn: 34205
* Simplify code by using value::takenameChris Lattner2007-02-111-46/+43
| | | | llvm-svn: 34176
* Fix miscompilations of consumer-typeset, telecomm-gsm, and 176.gcc.Chris Lattner2007-02-051-6/+6
| | | | llvm-svn: 33902
* fix a miscompilation of 176.gccChris Lattner2007-02-051-2/+2
| | | | llvm-svn: 33900
* rewrite shift/shift folding, now that types are not signed.Chris Lattner2007-02-051-74/+103
| | | | llvm-svn: 33892
* For PR1163:Reid Spencer2007-02-041-0/+1
| | | | | | | Make the Module's dependent library use a std::vector instead of SetVector adjust #includes in .cpp files because SetVector.h is no longer included. llvm-svn: 33855
* remove some dead codeChris Lattner2007-02-031-14/+3
| | | | llvm-svn: 33845
* Remove dead code and fix indentation per Chris' review comments.Reid Spencer2007-02-021-31/+12
| | | | llvm-svn: 33785
* Use short form of binary operator create functions.Reid Spencer2007-02-021-23/+23
| | | | llvm-svn: 33783
* bugfix for reid's shift patch.Chris Lattner2007-02-021-2/+2
| | | | llvm-svn: 33779
* Changes to support making the shift instructions be true BinaryOperators.Reid Spencer2007-02-021-138/+157
| | | | | | | | | | | | This feature is needed in order to support shifts of more than 255 bits on large integer types. This changes the syntax for llvm assembly to make shl, ashr and lshr instructions look like a binary operator: shl i32 %X, 1 instead of shl i32 %X, i8 1 Additionally, this should help a few passes perform additional optimizations. llvm-svn: 33776
* Fix Transforms/InstCombine/2007-02-01-LoadSinkAlloca.ll, a serious codeChris Lattner2007-02-011-0/+24
| | | | | | | pessimization where instcombine can sink a load (good for code size) that prevents an alloca from being promoted by mem2reg (bad for everything). llvm-svn: 33771
* remove temporary vectors.Chris Lattner2007-01-311-2/+2
| | | | llvm-svn: 33715
* Revert another incorrectly applied chunk, which fixes ↵Chris Lattner2007-01-311-7/+0
| | | | | | InstCombine/vec_insert_to_shuffle.ll llvm-svn: 33705
* eliminate temporary vectorsChris Lattner2007-01-311-6/+10
| | | | llvm-svn: 33693
* Move symbolic constant folding code to libanalysis.Chris Lattner2007-01-311-106/+0
| | | | llvm-svn: 33688
* Adjust #includes to match movement of constant folding code from ↵Chris Lattner2007-01-301-0/+1
| | | | | | transformutils to libanalysis. llvm-svn: 33680
* pass TD to constant folding apisChris Lattner2007-01-301-2/+2
| | | | llvm-svn: 33674
* remove some bits that are not yet meant to land.Chris Lattner2007-01-301-57/+0
| | | | llvm-svn: 33666
* Symbolically evaluate constant expressions like &A[123] - &A[4].f.Chris Lattner2007-01-301-2/+143
| | | | | | | | | | | | | | | | | | | | | | | This occurs in C++ code like: #include <iostream> #include <iterator> int a[] = { 1, 2, 3, 4, 5 }; int main() { using namespace std; copy(a, a + sizeof(a)/sizeof(a[0]), ostream_iterator<int>(cout, "\n")); return 0; } Before we would decide the loop trip count is: sdiv (i32 sub (i32 ptrtoint (i32* getelementptr ([5 x i32]* @a, i32 0, i32 5) to i32), i32 ptrtoint ([5 x i32]* @a to i32)), i32 4) Now we decide it is "5". Amazing. This code will need to be refactored, but I'm doing that as a separate commit. llvm-svn: 33665
* For PR1136: Rename GlobalVariable::isExternal as isDeclaration to avoidReid Spencer2007-01-301-5/+5
| | | | | | confusion with external linkage types. llvm-svn: 33663
* Fix test/Transforms/InstCombine/2007-01-27-AndICmp.ll, a miscompilation ofChris Lattner2007-01-271-1/+2
| | | | | | Mozilla that Anton tracked down. llvm-svn: 33591
* Cleanup checks in the load and store of casted pointer transforms. TwoReid Spencer2007-01-221-8/+7
| | | | | | | | changes: (1) don't special case for i1 any more, (2) use the new TargetData::getTypeSizeInBits method to ensure source and dest are the same bit width. llvm-svn: 33427
* Revise the store V, (cast P) -> store (cast V) -> P transform.Reid Spencer2007-01-201-9/+4
| | | | | | | | | We only want to do this if the src and destination types have the same bit width. This patch uses TargetData::getTypeSizeInBits() instead of making a special case for integer types and avoiding the transform if they don't match. llvm-svn: 33414
* Teach TargetData to handle 'preferred' alignment for each target, and useChris Lattner2007-01-201-9/+15
| | | | | | these alignment amounts to align scalars when we can. Patch by Scott Michel! llvm-svn: 33409
* For this transform: store V, (cast P) -> store (cast V), PReid Spencer2007-01-191-3/+4
| | | | | | | don't allow the transform if V and the pointer's element type are different width integer types. llvm-svn: 33371
* For PR1043:Reid Spencer2007-01-191-38/+38
| | | | | | | | | | | | | | This is the final patch for this PR. It implements some minor cleanup in the use of IntegerType, to wit: 1. Type::getIntegerTypeMask -> IntegerType::getBitMask 2. Type::Int*Ty changed to IntegerType* from Type* 3. ConstantInt::getType() returns IntegerType* now, not Type* This also fixes PR1120. Patch by Sheng Zhou. llvm-svn: 33370
* Fix InstCombine/2007-01-18-VectorInfLoop.ll, a case where instcombineChris Lattner2007-01-181-3/+9
| | | | | | infinitely loops. llvm-svn: 33343
* Clean up some code around the store V, (cast P) -> store (cast V), PReid Spencer2007-01-181-8/+14
| | | | | | | | | transform. Change some variable names so it is clear what is source and what is dest of the cast. Also, add an assert to ensure that the integer to integer case is asserting if the bitwidths are different. This prevents illegal casts from being formed and catches bitwidth bugs sooner. llvm-svn: 33337
* Fix a regression in my isIntegral patch that broke 471.omnetpp. This isChris Lattner2007-01-151-6/+8
| | | | | | | | because TargetData::getTypeSize() returns the same for i1 and i8. This fix is not right for the full generality of bitwise types, but it fixes the regression. llvm-svn: 33237
* Implement InstCombine/phi.ll:test7, deletion of trivial value loops forChris Lattner2007-01-151-2/+16
| | | | | | induction variables. llvm-svn: 33234
* simplify some code now that types are signlessChris Lattner2007-01-151-46/+12
| | | | llvm-svn: 33232
* delete stores to allocas with one use. This is a trivial form of DSE whichChris Lattner2007-01-151-0/+18
| | | | | | often kicks in for ?: expressions. llvm-svn: 33231
* rename Type::isIntegral to Type::isInteger, eliminating the old Type::isInteger.Chris Lattner2007-01-151-54/+54
| | | | | | | | | rename Type::getIntegralTypeMask to Type::getIntegerTypeMask. This makes naming much more consistent. For example, there are now no longer any instances of IntegerType that are not considered isInteger! :) llvm-svn: 33225
* Eliminate calls to isInteger, generalizing code and tightening checks as needed.Chris Lattner2007-01-151-12/+12
| | | | llvm-svn: 33218
* instcombine has always been miscompiling fcmp x, x, disregarding possibleChris Lattner2007-01-141-15/+39
| | | | | | NANs. This fixes PR1111 and Transforms/InstCombine/2007-01-14-FcmpSelf.ll llvm-svn: 33208
* Fix Transforms/InstCombine/2007-01-13-ExtCompareMiscompile.ll, which is partChris Lattner2007-01-131-3/+13
| | | | | | of PR1107 llvm-svn: 33185
* For PR1064:Reid Spencer2007-01-121-19/+14
| | | | | | | | | | | | | | | | | | | | | | | Implement the arbitrary bit-width integer feature. The feature allows integers of any bitwidth (up to 64) to be defined instead of just 1, 8, 16, 32, and 64 bit integers. This change does several things: 1. Introduces a new Derived Type, IntegerType, to represent the number of bits in an integer. The Type classes SubclassData field is used to store the number of bits. This allows 2^23 bits in an integer type. 2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and 64-bit integers. These are replaced with just IntegerType which is not a primitive any more. 3. Adjust the rest of LLVM to account for this change. Note that while this incremental change lays the foundation for arbitrary bit-width integers, LLVM has not yet been converted to actually deal with them in any significant way. Most optimization passes, for example, will still only deal with the byte-width integer types. Future increments will rectify this situation. llvm-svn: 33113
OpenPOWER on IntegriCloud