summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
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
commit612fa8e6f3bf93751807512287f377ae9a227d3c (patch)
treea7c82d912bef589803bbe158612cedad78184beb /llvm/lib/Transforms/Scalar/InstructionCombining.cpp
parentdab5696f84d67919b57150abce34e4828a772f27 (diff)
downloadbcm5719-llvm-612fa8e6f3bf93751807512287f377ae9a227d3c.tar.gz
bcm5719-llvm-612fa8e6f3bf93751807512287f377ae9a227d3c.zip
Fix Transforms/InstCombine/2006-03-30-ExtractElement.ll
llvm-svn: 27261
Diffstat (limited to 'llvm/lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 397c6d6ecd6..cd734568ba5 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud