================
@@ -231,11 +235,45 @@ bool InstrumentorImpl::instrumentFunction(Function &Fn) {
return Changed;
InstrumentationCaches ICaches;
+ SmallVector<Instruction *> FinalTIs;
ReversePostOrderTraversal<Function *> RPOT(&Fn);
- for (auto &It : RPOT)
+ for (auto &It : RPOT) {
for (auto &I : *It)
Changed |= instrumentInstruction(I, ICaches);
+ auto *TI = It->getTerminator();
+ if (!TI->getNumSuccessors())
+ FinalTIs.push_back(TI);
+ }
+
+ Value *FPtr = &Fn;
+ for (auto &[Name, IO] :
+ IConf.IChoices[InstrumentationLocation::FUNCTION_PRE]) {
+ if (!IO->Enabled)
+ continue;
+ // Count epochs eagerly.
+ ++IIRB.Epoch;
+
+ IIRB.IRB.SetInsertPointPastAllocas(cast<Function>(FPtr));
+ ensureDbgLoc(IIRB.IRB);
+ IO->instrument(FPtr, IConf, IIRB, ICaches);
+ IIRB.returnAllocas();
----------------
kevinsala wrote:
Is this safe to return the temporary allocas here? I'm wondering if they can
end up being re-used by another RT call and overwriting the value incorrectly.
I remember we had such an issue in the past.
https://github.com/llvm/llvm-project/pull/195378
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits