diff options
author | Joey Gouly <joey.gouly@arm.com> | 2013-05-24 12:29:54 +0000 |
---|---|---|
committer | Joey Gouly <joey.gouly@arm.com> | 2013-05-24 12:29:54 +0000 |
commit | 83699284be38eea39a74a52d5cf5483a1237d31e (patch) | |
tree | af5ede2aa1593d197e65951044076ccb5a2dbb5f /llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp | |
parent | c63995394de60996ebfe52a47cf2e3a0716d7e3c (diff) | |
download | bcm5719-llvm-83699284be38eea39a74a52d5cf5483a1237d31e.tar.gz bcm5719-llvm-83699284be38eea39a74a52d5cf5483a1237d31e.zip |
scalarizePHI needs to insert the next ExtractElement in the same block
as the BinaryOperator, *not* in the block where the IRBuilder is currently
inserting into. Fixes a bug where scalarizePHI would create instructions
that would not dominate all uses.
llvm-svn: 182639
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp index 4301ddb5aad..527ddbca398 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp @@ -146,8 +146,10 @@ Instruction *InstCombiner::scalarizePHI(ExtractElementInst &EI, PHINode *PN) { // vector operand. BinaryOperator *B0 = cast<BinaryOperator>(PHIUser); unsigned opId = (B0->getOperand(0) == PN) ? 1: 0; - Value *Op = Builder->CreateExtractElement( - B0->getOperand(opId), Elt, B0->getOperand(opId)->getName()+".Elt"); + Value *Op = InsertNewInstWith( + ExtractElementInst::Create(B0->getOperand(opId), Elt, + B0->getOperand(opId)->getName() + ".Elt"), + *B0); Value *newPHIUser = InsertNewInstWith( BinaryOperator::Create(B0->getOpcode(), scalarPHI,Op), *B0); |