mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-23 01:24:30 +00:00
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
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user