Skip to content

Commit af1b3ab

Browse files
authored
Fix overwritten print bug (rust-lang#985)
1 parent b2f9d57 commit af1b3ab

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

enzyme/Enzyme/EnzymeLogic.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,14 @@ struct CacheAnalysis {
142142
} else if (isa<UndefValue>(obj) || isa<ConstantPointerNull>(obj)) {
143143
return false;
144144
} else if (auto arg = dyn_cast<Argument>(obj)) {
145-
if (arg->getArgNo() < overwritten_args.size()) {
145+
if (arg->getArgNo() >= overwritten_args.size()) {
146146
llvm::errs() << "overwritten_args:\n";
147147
for (auto pair : overwritten_args) {
148148
llvm::errs() << " + " << pair << "\n";
149149
}
150150
llvm::errs() << "could not find " << *arg << " of func "
151151
<< arg->getParent()->getName() << " in args_map\n";
152+
llvm_unreachable("could not find arg in args_map");
152153
}
153154
if (overwritten_args[arg->getArgNo()]) {
154155
mustcache = true;

0 commit comments

Comments
 (0)