Skip to content

Commit 4969db6

Browse files
itsimbalsys_zuul
authored andcommitted
A code in calculate_dep for binary ops when processing AShr is
trying to look for dependency of operands of its operands (sort of double reference) and hit the case the dependency is not set yet. Check for this case and bail-out. Change-Id: I1ec9d12e95045fc26b82677c245db1b570e30451
1 parent c036912 commit 4969db6

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

IGC/Compiler/CISACodeGen/WIAnalysis.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,24 @@ void WIAnalysisRunner::calculate_dep(const Value* val)
640640
{
641641
// We do not calculate non-PhiNode instruction that have unset operands
642642
if (unsetOpNum > 0) return;
643+
644+
// We have all operands set. Check a special case from calculate_dep for
645+
// binary ops (see the details below). It checks for ASHR+ADD and ASHR+SHL
646+
// cases, and in particular it accesses dependency for ADD operands. It
647+
// could happen these operands are not processed yet and in such case
648+
// getDependency raises the assertion. Thus check if dependency is set.
649+
// Currently we need to check dependency for ASHR->ADD operands only.
650+
// For SHR, its operands are checked to be constant so skip this case.
651+
// This code could be extended further depending on requirements.
652+
if (inst->getOpcode() == Instruction::AShr)
653+
{
654+
BinaryOperator* op0 = dyn_cast<BinaryOperator>(inst->getOperand(0));
655+
if (op0 && op0->getOpcode() == Instruction::Add &&
656+
!hasDependency(op0->getOperand(1)))
657+
{
658+
return;
659+
}
660+
}
643661
}
644662
orig = WIAnalysis::UNIFORM;
645663
}

0 commit comments

Comments
 (0)