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 | 4a941316cdcfbc3671c806c9c40df1bad09ba6ad (patch) | |
tree | 5ac3f64e9853eaace017dc109c5871e4dd04e54e /lib/Transforms/InstCombine/InstCombineVectorOps.cpp | |
parent | 77226a03dca98e6237c1068f2652fe41bea7b687 (diff) | |
download | external_llvm-4a941316cdcfbc3671c806c9c40df1bad09ba6ad.zip external_llvm-4a941316cdcfbc3671c806c9c40df1bad09ba6ad.tar.gz external_llvm-4a941316cdcfbc3671c806c9c40df1bad09ba6ad.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182639 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombineVectorOps.cpp')
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineVectorOps.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/lib/Transforms/InstCombine/InstCombineVectorOps.cpp index 4301ddb..527ddbc 100644 --- a/lib/Transforms/InstCombine/InstCombineVectorOps.cpp +++ b/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); |