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/Analysis/CodeMetrics.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/Analysis/CodeMetrics.cpp')
-rw-r--r-- | llvm/lib/Analysis/CodeMetrics.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/llvm/lib/Analysis/CodeMetrics.cpp b/llvm/lib/Analysis/CodeMetrics.cpp index 157811c..b0b46cb 100644 --- a/llvm/lib/Analysis/CodeMetrics.cpp +++ b/llvm/lib/Analysis/CodeMetrics.cpp @@ -73,9 +73,7 @@ void CodeMetrics::collectEphemeralValues( SmallVector<const Value *, 16> Worklist; for (auto &AssumeVH : AC->assumptions()) { - if (!AssumeVH) - continue; - Instruction *I = cast<Instruction>(AssumeVH); + Instruction *I = AssumeVH.getAssumeCI(); // Filter out call sites outside of the loop so we don't do a function's // worth of work for each of its loops (and, in the common case, ephemeral @@ -97,9 +95,7 @@ void CodeMetrics::collectEphemeralValues( SmallVector<const Value *, 16> Worklist; for (auto &AssumeVH : AC->assumptions()) { - if (!AssumeVH) - continue; - Instruction *I = cast<Instruction>(AssumeVH); + Instruction *I = AssumeVH.getAssumeCI(); assert(I->getParent()->getParent() == F && "Found assumption for the wrong function!"); |