Skip to content

Commit 65ce2cf

Browse files
committed
[GlobalISel] Fix fewerElementsVectorPhi to insert after G_PHIs
Currently the inserted mergelike instructions will be inserted at the location of the G_PHI. Seems like the behaviour was correct before, but the rework done in https://reviews.llvm.org/D114198 forgot to include the part which makes sure the instructions will be inserted after all the G_PHIs.
1 parent 7a4e897 commit 65ce2cf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4265,6 +4265,10 @@ LegalizerHelper::fewerElementsVectorPhi(GenericMachineInstr &MI,
42654265
}
42664266
}
42674267

4268+
// Set the insert point after the existing PHIs
4269+
MachineBasicBlock &MBB = *MI.getParent();
4270+
MIRBuilder.setInsertPt(MBB, MBB.getFirstNonPHI());
4271+
42684272
// Merge small outputs into MI's def.
42694273
if (NumLeftovers) {
42704274
mergeMixedSubvectors(MI.getReg(0), OutputRegs);

0 commit comments

Comments
 (0)