Skip to content

Commit 152b64c

Browse files
kychendevigcbot
authored andcommitted
Fix a bug in local def hoisting.
Add conformity check to prevent illegal destination stride.
1 parent 8c2d1db commit 152b64c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

visa/G4_IR.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2901,6 +2901,15 @@ bool G4_INST::canHoistTo(const G4_INST *defInst, bool simdBB) const
29012901
return false;
29022902
}
29032903

2904+
// Don't hoist if the composed dst stride is illegal
2905+
G4_DstRegRegion *defDstRegion = def_dst->asDstRegRegion();
2906+
uint16_t defDstHS = defDstRegion->getHorzStride();
2907+
G4_CmpRelation rel = srcs[0]->compareOperand(defDstRegion, builder);
2908+
if (rel == Rel_gt && dstHS * defDstHS > 4)
2909+
{
2910+
return false;
2911+
}
2912+
29042913
// Don't hoist stack calls related variables (Arg, Retval, SP, FP)
29052914
if (defInst->getDst() && defInst->getDst()->getTopDcl())
29062915
{

0 commit comments

Comments
 (0)