diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index ffa6cd746b25d4..13ad5b560ef965 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -4494,18 +4494,6 @@ void ScalarEvolution::insertValueToMap(Value *V, const SCEV *S) { } } -/// Determine whether this instruction is either not SCEVable or will always -/// produce a SCEVUnknown. We do not have to walk past such instructions when -/// invalidating. -static bool isAlwaysUnknown(const Instruction *I) { - switch (I->getOpcode()) { - case Instruction::Load: - return true; - default: - return false; - } -} - /// Return an existing SCEV if it exists, otherwise analyze the expression and /// create a new one. const SCEV *ScalarEvolution::getSCEV(Value *V) { @@ -4513,11 +4501,7 @@ const SCEV *ScalarEvolution::getSCEV(Value *V) { if (const SCEV *S = getExistingSCEV(V)) return S; - const SCEV *S = createSCEVIter(V); - assert((!isa(V) || !isAlwaysUnknown(cast(V)) || - isa(S)) && - "isAlwaysUnknown() instruction is not SCEVUnknown"); - return S; + return createSCEVIter(V); } const SCEV *ScalarEvolution::getExistingSCEV(Value *V) { @@ -4818,8 +4802,6 @@ static void PushDefUseChildren(Instruction *I, // Push the def-use children onto the Worklist stack. for (User *U : I->users()) { auto *UserInsn = cast(U); - if (isAlwaysUnknown(UserInsn)) - continue; if (Visited.insert(UserInsn).second) Worklist.push_back(UserInsn); } diff --git a/llvm/test/Transforms/IndVarSimplify/pr68260.ll b/llvm/test/Transforms/IndVarSimplify/pr68260.ll index 3b460209cf30de..fb185d2015b646 100644 --- a/llvm/test/Transforms/IndVarSimplify/pr68260.ll +++ b/llvm/test/Transforms/IndVarSimplify/pr68260.ll @@ -4,7 +4,6 @@ declare void @use(i32) -; FIXME: This is a miscompile. define void @test() { ; CHECK-LABEL: define void @test() { ; CHECK-NEXT: entry: @@ -14,7 +13,7 @@ define void @test() { ; CHECK: loop2: ; CHECK-NEXT: br i1 false, label [[LOOP2]], label [[LOOP_LATCH:%.*]], !llvm.loop [[LOOP0:![0-9]+]] ; CHECK: loop.latch: -; CHECK-NEXT: call void @use(i32 4) +; CHECK-NEXT: call void @use(i32 3) ; CHECK-NEXT: br label [[LOOP2_1:%.*]] ; CHECK: loop2.1: ; CHECK-NEXT: br i1 false, label [[LOOP2_1]], label [[LOOP_LATCH_1:%.*]], !llvm.loop [[LOOP0]]