Skip to content

Commit

Permalink
Better error messages for invalid erasure (#1592)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses authored Dec 18, 2023
1 parent 2d0b3bb commit 686a7bb
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions enzyme/Enzyme/CacheUtility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,19 @@ void CacheUtility::erase(Instruction *I) {
SE.eraseValueFromMap(I);

if (!I->use_empty()) {
std::string str;
raw_string_ostream ss(str);
ss << "Erased value with a use:\n";
ss << *newFunc->getParent() << "\n";
ss << *newFunc << "\n";
ss << *I << "\n";
if (CustomErrorHandler) {
std::string str;
raw_string_ostream ss(str);
ss << "Erased value with a use:\n";
ss << *newFunc->getParent() << "\n";
ss << *newFunc << "\n";
ss << *I << "\n";
CustomErrorHandler(str.c_str(), wrap(I), ErrorType::InternalError,
nullptr, nullptr, nullptr);
} else {
EmitFailure("GetIndexError", I->getDebugLoc(), I, ss.str());
}
llvm::errs() << *newFunc->getParent() << "\n";
llvm::errs() << *newFunc << "\n";
llvm::errs() << *I << "\n";
I->replaceAllUsesWith(UndefValue::get(I->getType()));
}
assert(I->use_empty());
I->eraseFromParent();
Expand Down

0 comments on commit 686a7bb

Please sign in to comment.