diff --git a/llvm/lib/Analysis/AssumptionCache.cpp b/llvm/lib/Analysis/AssumptionCache.cpp --- a/llvm/lib/Analysis/AssumptionCache.cpp +++ b/llvm/lib/Analysis/AssumptionCache.cpp @@ -62,7 +62,7 @@ auto AddAffected = [&Affected](Value *V, unsigned Idx = AssumptionCache::ExprResultIdx) { - if (isa(V)) { + if (isa(V) || isa(V)) { Affected.push_back({V, Idx}); } else if (auto *I = dyn_cast(V)) { Affected.push_back({I, Idx}); diff --git a/llvm/test/Analysis/AssumptionCache/basic.ll b/llvm/test/Analysis/AssumptionCache/basic.ll --- a/llvm/test/Analysis/AssumptionCache/basic.ll +++ b/llvm/test/Analysis/AssumptionCache/basic.ll @@ -20,3 +20,14 @@ ret void } + +@G = external global i32 +define void @test2() { +; CHECK-LABEL: Cached assumptions for function: test2 +; CHECK-NEXT: icmp ne ptr @G, null + +entry: + %cond1 = icmp ne ptr @G, null + call void @llvm.assume(i1 %cond1) + ret void +} diff --git a/llvm/test/Analysis/ScalarEvolution/ranges.ll b/llvm/test/Analysis/ScalarEvolution/ranges.ll --- a/llvm/test/Analysis/ScalarEvolution/ranges.ll +++ b/llvm/test/Analysis/ScalarEvolution/ranges.ll @@ -29,7 +29,7 @@ ; CHECK-LABEL: 'ashr_global' ; CHECK-NEXT: Classifying expressions for: @ashr_global ; CHECK-NEXT: %ashr = ashr i64 ptrtoint (ptr @G to i64), 63 -; CHECK-NEXT: --> %ashr U: [-1,1) S: [-1,1) +; CHECK-NEXT: --> %ashr U: [0,1) S: [0,1) ; CHECK-NEXT: Determining loop execution counts for: @ashr_global ; %ashr = ashr i64 ptrtoint (ptr @G to i64), 63