diff options
| author | Chris Lattner <sabre@nondot.org> | 2009-10-11 23:02:46 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2009-10-11 23:02:46 +0000 |
| commit | 2c2deae5ac7c3c8442d9e634554160ebb4cd7622 (patch) | |
| tree | 483081f4e70ecfc91387498cacbb8a91ce2c50ef /llvm/lib/Transforms | |
| parent | da0508fe158b100bf609a0681c51d7d59543880a (diff) | |
| download | bcm5719-llvm-2c2deae5ac7c3c8442d9e634554160ebb4cd7622.tar.gz bcm5719-llvm-2c2deae5ac7c3c8442d9e634554160ebb4cd7622.zip | |
remove some harmful code that would turn an insertelement on an undef
into a shuffle even if it was used by another insertelement. If the
visitation order of instcombine was wrong, this would turn a chain of
insertelements into a chain of shufflevectors, which was quite painful.
Since CollectShuffleElements handles these cases, the code can just
be nuked.
llvm-svn: 83810
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index dcb65a8ed91..0c790f63150 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -12472,28 +12472,6 @@ Instruction *InstCombiner::visitInsertElementInst(InsertElementInst &IE) { if (EI->getOperand(0) == VecOp && ExtractedIdx == InsertedIdx) return ReplaceInstUsesWith(IE, VecOp); - // We could theoretically do this for ANY input. However, doing so could - // turn chains of insertelement instructions into a chain of shufflevector - // instructions, and right now we do not merge shufflevectors. As such, - // only do this in a situation where it is clear that there is benefit. - if (isa<UndefValue>(VecOp) || isa<ConstantAggregateZero>(VecOp)) { - // Turn this into shuffle(EIOp0, VecOp, Mask). The result has all of - // the values of VecOp, except then one read from EIOp0. - // Build a new shuffle mask. - std::vector<Constant*> Mask; - if (isa<UndefValue>(VecOp)) - Mask.assign(NumVectorElts, UndefValue::get(Type::getInt32Ty(*Context))); - else { - assert(isa<ConstantAggregateZero>(VecOp) && "Unknown thing"); - Mask.assign(NumVectorElts, ConstantInt::get(Type::getInt32Ty(*Context), - NumVectorElts)); - } - Mask[InsertedIdx] = - ConstantInt::get(Type::getInt32Ty(*Context), ExtractedIdx); - return new ShuffleVectorInst(EI->getOperand(0), VecOp, - ConstantVector::get(Mask)); - } - // If this insertelement isn't used by some other insertelement, turn it // (and any insertelements it points to), into one big shuffle. if (!IE.hasOneUse() || !isa<InsertElementInst>(IE.use_back())) { |

