diff options
author | Arthur Eubanks <aeubanks@google.com> | 2023-03-15 09:13:13 -0700 |
---|---|---|
committer | Arthur Eubanks <aeubanks@google.com> | 2023-03-15 09:19:05 -0700 |
commit | 6d7da41b80e08a845e062dc62926cd58b4f1f5a8 (patch) | |
tree | 3a048afb704d1b543c713ff342e6a4a82efd658b /llvm/lib/Transforms/Utils/Debugify.cpp | |
parent | d58f5863c44d1a5b214f80d9b5c1123412c44ce2 (diff) | |
download | llvm-6d7da41b80e08a845e062dc62926cd58b4f1f5a8.zip llvm-6d7da41b80e08a845e062dc62926cd58b4f1f5a8.tar.gz llvm-6d7da41b80e08a845e062dc62926cd58b4f1f5a8.tar.bz2 |
[Debugify] Invalidate function analyses
Since debugify inserts instructions.
Diffstat (limited to 'llvm/lib/Transforms/Utils/Debugify.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Debugify.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/Debugify.cpp b/llvm/lib/Transforms/Utils/Debugify.cpp index 9894736..8e10a91 100644 --- a/llvm/lib/Transforms/Utils/Debugify.cpp +++ b/llvm/lib/Transforms/Utils/Debugify.cpp @@ -1027,16 +1027,22 @@ static bool isIgnoredPass(StringRef PassID) { } void DebugifyEachInstrumentation::registerCallbacks( - PassInstrumentationCallbacks &PIC) { - PIC.registerBeforeNonSkippedPassCallback([this](StringRef P, Any IR) { + PassInstrumentationCallbacks &PIC, FunctionAnalysisManager &FAM) { + PIC.registerBeforeNonSkippedPassCallback([this, &FAM](StringRef P, Any IR) { if (isIgnoredPass(P)) return; - if (const auto **F = any_cast<const Function *>(&IR)) + PreservedAnalyses PA; + PA.preserveSet<CFGAnalyses>(); + if (const auto **F = any_cast<const Function *>(&IR)) { applyDebugify(*const_cast<Function *>(*F), Mode, DebugInfoBeforePass, P); - else if (const auto **M = any_cast<const Module *>(&IR)) + FAM.invalidate(*const_cast<Function *>(*F), PA); + } else if (const auto **M = any_cast<const Module *>(&IR)) { applyDebugify(*const_cast<Module *>(*M), Mode, DebugInfoBeforePass, P); + for (Function &F : *const_cast<Module *>(*M)) + FAM.invalidate(F, PA); + } }); PIC.registerAfterPassCallback([this](StringRef P, Any IR, const PreservedAnalyses &PassPA) { |