Skip to content

Commit

Permalink
Fixed null dereference errors in SimdCF passes
Browse files Browse the repository at this point in the history
Fixed null dereference errors in GenXSimdCFConformance and GenXSimdCFRegion
  • Loading branch information
fveselov authored and igcbot committed Oct 24, 2023
1 parent eafef59 commit 3c8e167
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions IGC/VectorCompiler/lib/GenXCodeGen/GenXSimdCFConformance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4130,11 +4130,12 @@ void GenXLateSimdCFConformance::hoistExtractEMInstructions() {
else {
ToRemove.push_back(V);
V->replaceAllUsesWith(It->second);
V->eraseFromParent();
}
}
for (auto &&V : ToRemove)
for (auto &&V : ToRemove) {
removeFromEMRMVals(V);
V->eraseFromParent();
}
}

/***********************************************************************
Expand Down
2 changes: 1 addition & 1 deletion IGC/VectorCompiler/lib/GenXCodeGen/GenXSimdCFRegion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1180,11 +1180,11 @@ void GenXPredToSimdCF::insertIfGotoJoin(SimdCFIfRegion *R) {
if (R->hasElse()) {
auto *ElseExit = R->getIfThenRegion()->getExit();
Br = cast<BranchInst>(ElseExit->getTerminator());
auto *IfEndBB = IfThenExitBr->getSuccessor(1);
// 1-th: generate goto(EM, zeroinitializer, zeroinitializer) in the end of
// then-block
generateThenGoto(Br, JoinBlock);

auto *IfEndBB = IfThenExitBr->getSuccessor(1);
for (auto &PHI : IfEndBB->phis()) {
PHI.replaceIncomingBlockWith(IfThenExit, JoinBlock);
}
Expand Down

0 comments on commit 3c8e167

Please sign in to comment.