Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions llvm/include/llvm/Analysis/AssumptionCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class AssumptionCache {

/// Vector of weak value handles to calls of the \@llvm.assume
/// intrinsic.
SmallVector<ResultElem, 4> AssumeHandles;
SmallVector<WeakVH, 4> AssumeHandles;

class LLVM_ABI AffectedValueCallbackVH final : public CallbackVH {
AssumptionCache *AC;
Expand Down Expand Up @@ -148,7 +148,7 @@ class AssumptionCache {
/// FIXME: We should replace this with pointee_iterator<filter_iterator<...>>
/// when we can write that to filter out the null values. Then caller code
/// will become simpler.
MutableArrayRef<ResultElem> assumptions() {
MutableArrayRef<WeakVH> assumptions() {
if (!Scanned)
scanFunction();
return AssumeHandles;
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Analysis/AssumptionCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ void AssumptionCache::scanFunction() {
for (BasicBlock &B : F)
for (Instruction &I : B)
if (isa<AssumeInst>(&I))
AssumeHandles.push_back({&I, ExprResultIdx});
AssumeHandles.push_back(&I);

// Mark the scan as complete.
Scanned = true;
Expand All @@ -188,7 +188,7 @@ void AssumptionCache::registerAssumption(AssumeInst *CI) {
if (!Scanned)
return;

AssumeHandles.push_back({CI, ExprResultIdx});
AssumeHandles.push_back(CI);

#ifndef NDEBUG
assert(CI->getParent() &&
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Transforms/Scalar/DropUnnecessaryAssumes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ DropUnnecessaryAssumesPass::run(Function &F, FunctionAnalysisManager &FAM) {
AssumptionCache &AC = FAM.getResult<AssumptionAnalysis>(F);
bool Changed = false;

for (AssumptionCache::ResultElem &Elem : AC.assumptions()) {
auto *Assume = cast_or_null<AssumeInst>(Elem.Assume);
for (const WeakVH &Elem : AC.assumptions()) {
auto *Assume = cast_or_null<AssumeInst>(Elem);
if (!Assume)
continue;

Expand Down