SmallPtrSet<const SCEV *, 8> Seen = {S};
while (!Worklist.empty()) {
const SCEV *Curr = Worklist.pop_back_val();
- if (!LoopDispositions.erase(Curr) && !BlockDispositions.erase(S))
+ bool LoopDispoRemoved = LoopDispositions.erase(Curr);
+ bool BlockDispoRemoved = BlockDispositions.erase(Curr);
+ if (!LoopDispoRemoved && !BlockDispoRemoved)
continue;
-
auto Users = SCEVUsers.find(Curr);
if (Users != SCEVUsers.end())
for (const auto *User : Users->second)
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt -S -indvars -verify-scev < %s | FileCheck %s
+; RUN: opt -S -passes=indvars -verify-scev < %s | FileCheck %s
-define void @test() {
-; CHECK-LABEL: @test(
+define void @test_pr54434() {
+; CHECK-LABEL: @test_pr54434(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[FOR_COND:%.*]]
; CHECK: for.cond:
ret void
}
+define i32 @test_pr58439(i32 %a) {
+; CHECK-LABEL: @test_pr58439(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br label [[LOOP:%.*]]
+; CHECK: loop:
+; CHECK-NEXT: br i1 false, label [[LOOP]], label [[EXIT:%.*]]
+; CHECK: exit:
+; CHECK-NEXT: [[C_EXT_LCSSA:%.*]] = phi i32 [ 0, [[LOOP]] ]
+; CHECK-NEXT: [[OR:%.*]] = or i32 [[A:%.*]], 1
+; CHECK-NEXT: [[RES:%.*]] = add i32 [[C_EXT_LCSSA]], [[OR]]
+; CHECK-NEXT: ret i32 [[RES]]
+;
+entry:
+ %or = or i32 %a, 1
+ br label %loop
+
+loop:
+ %iv = phi i32 [ 1, %entry ], [ %iv.next, %loop ]
+ %iv.next = add i32 %iv, 1
+ %c.1 = icmp eq i32 %iv.next, %or
+ %c.ext = zext i1 %c.1 to i32
+ br i1 false, label %loop, label %exit
+
+exit:
+ %res = add i32 %c.ext, %or
+ ret i32 %res
+}