aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-03-30 22:02:40 +0000
committerChris Lattner <sabre@nondot.org>2006-03-30 22:02:40 +0000
commitdf084ff78b5aab5430612146d2fea323d66bdaf8 (patch)
tree62cb3094d758926e3a7eb0a6183fb9d8ccaa3c16
parentfc542a6466ed395b3adfa5653c77c28385b3e552 (diff)
Fix Transforms/InstCombine/2006-03-30-ExtractElement.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27261 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 397c6d6ecd..cd734568ba 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -6704,9 +6704,13 @@ Instruction *InstCombiner::visitExtractElementInst(ExtractElementInst &EI) {
if (IE->getOperand(2) == EI.getOperand(1))
return ReplaceInstUsesWith(EI, IE->getOperand(1));
// If the inserted and extracted elements are constants, they must not
- // be the same value, replace with the pre-inserted value.
- if (isa<Constant>(IE->getOperand(2)) && isa<Constant>(EI.getOperand(1)))
- return ReplaceInstUsesWith(EI, IE->getOperand(0));
+ // be the same value, extract from the pre-inserted value instead.
+ if (isa<Constant>(IE->getOperand(2)) &&
+ isa<Constant>(EI.getOperand(1))) {
+ AddUsesToWorkList(EI);
+ EI.setOperand(0, IE->getOperand(0));
+ return &EI;
+ }
}
}
return 0;