Skip to content

Commit

Permalink
Improve error on inserted phi scev
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses committed Dec 4, 2024
1 parent 7b97a9b commit 481ee9d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions enzyme/Enzyme/GradientUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7160,6 +7160,25 @@ Value *GradientUtils::lookupM(Value *val, IRBuilder<> &BuilderM,
return OrigDT->dominates(A, B);
});
for (auto a : InsertedInstructions) {
if (isa<PHINode>(a)) {
std::string str;
raw_string_ostream ss(str);
ss << "oldFunc: " << *oldFunc << "\n";
ss << "newFunc: " << *newFunc << "\n";
ss << "li: " << *li << "\n";
ss << "start0: " << *start0 << "\n";
ss << "Inserted a phi node (" << *a
<< ") during unwrap of SCEV: " << *ar1->getStart()
<< "\n";
if (CustomErrorHandler) {
CustomErrorHandler(str.c_str(), wrap(li),
ErrorType::InternalError, nullptr,
nullptr, nullptr);
} else {
EmitFailure("InsertedPHISCEV", li->getDebugLoc(), li,
ss.str());
}
}
assert(!isa<PHINode>(a));
auto uw = cast<Instruction>(
unwrapM(a, v, available, UnwrapMode::AttemptSingleUnwrap,
Expand Down

0 comments on commit 481ee9d

Please sign in to comment.