Skip to content

Commit c8de4b0

Browse files
jackm321facebook-github-bot
authored andcommitted
Fix crash with --instrument-debug (#3704)
Summary: Currently calls `IRFunction::insertInstruction` with `InstListTy::end` iterator and crashes Documentation: n/a Pull Request resolved: #3704 Test Plan: `ninja all` `./tests/InterpreterOperatorTest --instrument-debug` no crash Differential Revision: D18240758 Pulled By: jackm321 fbshipit-source-id: 85018a5f1546b8844ce7963de89cf3bb043befce
1 parent 162ecaf commit c8de4b0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/Optimizer/IROptimizer/IROptimizer.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1538,7 +1538,11 @@ static void performDebugInstrumentation(IRFunction &M) {
15381538
name += ".";
15391539
name += I->getKindName();
15401540
auto *dumpInstr = new DebugPrintInst(name, Op.first);
1541-
M.insertInstruction(&*next, dumpInstr);
1541+
if (next == e) {
1542+
M.insertInstruction(dumpInstr);
1543+
} else {
1544+
M.insertInstruction(&*next, dumpInstr);
1545+
}
15421546
}
15431547
}
15441548
it = next;

0 commit comments

Comments
 (0)