Skip to content

Commit fb5a4b3

Browse files
committed
track handled blocks
1 parent 47d2c6b commit fb5a4b3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

llvm/lib/Transforms/Utils/CFFunctionInstrumentation.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,14 @@ CFFunctionInstrumentationPass::run(Module &M, ModuleAnalysisManager &AM) {
3636
StringRef funcFileName = StringRef(fileName);
3737
// for all return instructions, print the return value to a file with the
3838
// name of the function
39+
40+
// store already handled blocks
41+
std::set<BasicBlock *> HandledBlocks;
3942
for (auto &BB : F) {
4043
// Do NOT reinstrument the inserted blocks
4144
if (BB.getName() == "return" || BB.getName() == "print" ||
4245
BB.getName() == "open") {
46+
HandledBlocks.insert(&BB);
4347
continue;
4448
}
4549
if (auto *RI = dyn_cast<ReturnInst>(BB.getTerminator())) {
@@ -118,6 +122,7 @@ CFFunctionInstrumentationPass::run(Module &M, ModuleAnalysisManager &AM) {
118122
ReturnBB->moveAfter(PrintBB);
119123
}
120124
}
125+
HandledBlocks.insert(&BB);
121126
}
122127
}
123128

0 commit comments

Comments
 (0)