Skip to content

Commit ac0ac23

Browse files
Gang Y Chenigcbot
authored andcommitted
replace extract-element at its original location
to preserve load-clustering effect
1 parent e23f2e6 commit ac0ac23

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

IGC/Compiler/CISACodeGen/VectorPreProcess.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,10 +1550,11 @@ Instruction* VectorPreProcess::simplifyLoadStore(Instruction* Inst)
15501550
unsigned Idx = int_cast<unsigned>(CI->getZExtValue());
15511551
if (NewEEI[Idx] == nullptr)
15521552
{
1553-
NewEEI[Idx] = Builder.CreateExtractElement(NewLI, CI);
1553+
// To preserve the order, insert next to the original EEI
1554+
NewEEI[Idx] = ExtractElementInst::Create(NewLI, CI, "", EEI);
15541555
if (BC)
15551556
{
1556-
NewBC[Idx] = Builder.CreateBitCast(NewEEI[Idx], DstEltTy);
1557+
NewBC[Idx] = CastInst::Create(BC->getOpcode(), NewEEI[Idx], DstEltTy, "", EEI);
15571558
dyn_cast<BitCastInst>(NewBC[Idx])->setDebugLoc(BC->getDebugLoc());
15581559
}
15591560
}

0 commit comments

Comments
 (0)