diff options
author | Johannes Doerfert <johannes@jdoerfert.de> | 2021-02-05 10:53:33 -0600 |
---|---|---|
committer | Johannes Doerfert <johannes@jdoerfert.de> | 2021-02-06 12:18:39 -0600 |
commit | b7d870eae7fdadcf10d0f177faa7409c2e37d776 (patch) | |
tree | 208eb97f65ea5d11d7390f386a87332b94c946dd /llvm/lib/Transforms/Utils/PredicateInfo.cpp | |
parent | 378f4e5ec26c3e0d2119c1112ec645b369eed2de (diff) | |
download | llvm-b7d870eae7fdadcf10d0f177faa7409c2e37d776.zip llvm-b7d870eae7fdadcf10d0f177faa7409c2e37d776.tar.gz llvm-b7d870eae7fdadcf10d0f177faa7409c2e37d776.tar.bz2 |
[AssumptionCache] Avoid dangling llvm.assume calls in the cache
PR49043 exposed a problem when it comes to RAUW llvm.assumes. While
D96106 would fix it for GVNSink, it seems a more general concern. To
avoid future problems this patch moves away from the vector of weak
reference model used in the assumption cache. Instead, we track the
llvm.assume calls with a callback handle which will remove itself from
the cache if the call is deleted.
Fixes PR49043.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D96168
Diffstat (limited to 'llvm/lib/Transforms/Utils/PredicateInfo.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/PredicateInfo.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/PredicateInfo.cpp b/llvm/lib/Transforms/Utils/PredicateInfo.cpp index 3312a6f..af5a72a 100644 --- a/llvm/lib/Transforms/Utils/PredicateInfo.cpp +++ b/llvm/lib/Transforms/Utils/PredicateInfo.cpp @@ -532,10 +532,11 @@ void PredicateInfoBuilder::buildPredicateInfo() { processSwitch(SI, BranchBB, OpsToRename); } } - for (auto &Assume : AC.assumptions()) { - if (auto *II = dyn_cast_or_null<IntrinsicInst>(Assume)) - if (DT.isReachableFromEntry(II->getParent())) - processAssume(II, II->getParent(), OpsToRename); + for (auto &AssumeVH : AC.assumptions()) { + CallInst *AssumeCI = AssumeVH.getAssumeCI(); + if (DT.isReachableFromEntry(AssumeCI->getParent())) + processAssume(cast<IntrinsicInst>(AssumeCI), AssumeCI->getParent(), + OpsToRename); } // Now rename all our operations. renameUses(OpsToRename); |