[llvm] [indvars] Update SCEV after eliminating CmpInst of loop latch (PR #207044)

Hassnaa Hamdi via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 5 19:53:08 PDT 2026


https://github.com/hassnaaHamdi updated https://github.com/llvm/llvm-project/pull/207044

>From 2bb6f8768107f66a071991ee5f6e1dd1910b3285 Mon Sep 17 00:00:00 2001
From: Hassnaa Hamdi <hassnaa.hamdi at arm.com>
Date: Wed, 1 Jul 2026 14:43:23 +0000
Subject: [PATCH 1/3] [indvars] pre-commit test case

---
 .../eliminate-exit-comparison.ll              | 32 +++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 llvm/test/Transforms/IndVarSimplify/eliminate-exit-comparison.ll

diff --git a/llvm/test/Transforms/IndVarSimplify/eliminate-exit-comparison.ll b/llvm/test/Transforms/IndVarSimplify/eliminate-exit-comparison.ll
new file mode 100644
index 0000000000000..388ffdca064bd
--- /dev/null
+++ b/llvm/test/Transforms/IndVarSimplify/eliminate-exit-comparison.ll
@@ -0,0 +1,32 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
+; RUN: opt -passes='loop(indvars),print<scalar-evolution>' -S -disable-output < %s 2>&1 | FileCheck %s
+
+; CHECK:  Determining loop execution counts for: @combined_bridge
+; CHECK-NEXT:  Loop %inner2.ph.i: backedge-taken count is i64 -1
+; CHECK-NEXT:  Loop %inner2.ph.i: constant max backedge-taken count is i64 -1
+; CHECK-NEXT:  Loop %inner2.ph.i: symbolic max backedge-taken count is i64 -1
+; CHECK-NEXT:  Loop %inner2.ph.i: Trip multiple is 2147483648
+; CHECK-NEXT:  Loop %inner1.ph.i: backedge-taken count is i64 -1
+; CHECK-NEXT:  Loop %inner1.ph.i: constant max backedge-taken count is i64 -1
+; CHECK-NEXT:  Loop %inner1.ph.i: symbolic max backedge-taken count is i64 -1
+
+define i64 @combined_bridge() {
+
+entry:
+  br label %inner1.ph.i
+
+inner1.ph.i:                                      ; preds = %inner1.ph.i, %entry
+  %iv74.i = phi i64 [ 0, %entry ], [ %iv.next75.i, %inner1.ph.i ]
+  %iv.next75.i = add nsw i64 %iv74.i, 1
+  %exitcond77.i = icmp eq i64 %iv.next75.i, 0
+  br i1 %exitcond77.i, label %inner2.ph.i, label %inner1.ph.i
+
+inner2.ph.i:                                      ; preds = %inner2.ph.i, %inner1.ph.i
+  %iv66.i = phi i64 [ %iv.next67.i, %inner2.ph.i ], [ 0, %inner1.ph.i ]
+  %iv.next67.i = add nsw i64 %iv66.i, 1
+  %exitcond69.i = icmp eq i64 %iv.next67.i, 0
+  br i1 %exitcond69.i, label %outer2.exit.i, label %inner2.ph.i
+
+outer2.exit.i:                                    ; preds = %inner2.ph.i
+  ret i64 0
+}

>From b6053530229cf7e41e7b268adbe7e28f45d591ef Mon Sep 17 00:00:00 2001
From: Hassnaa Hamdi <hassnaa.hamdi at arm.com>
Date: Wed, 1 Jul 2026 17:56:59 +0000
Subject: [PATCH 2/3] [indvars] Update SCEV after eliminating CmpInst of loop
 latch

---
 llvm/lib/Transforms/Utils/SimplifyIndVar.cpp  |  5 +++
 .../eliminate-exit-comparison.ll              | 13 +++---
 .../invalidate-modified-lcssa-phi.ll          |  2 +-
 .../test/Transforms/IndVarSimplify/pr55689.ll |  3 --
 llvm/test/Transforms/LoopDeletion/pr53969.ll  | 42 ++++++++++++++++---
 llvm/test/Transforms/LoopUnroll/scevunroll.ll |  2 +-
 6 files changed, 49 insertions(+), 18 deletions(-)

diff --git a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
index 9e0bbe9cf3b62..88a124f43b34c 100644
--- a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
@@ -266,6 +266,9 @@ void SimplifyIndvar::eliminateIVComparison(ICmpInst *ICmp,
   const SCEV *S = SE->getSCEVAtScope(ICmp->getOperand(IVOperIdx), ICmpLoop);
   const SCEV *X = SE->getSCEVAtScope(ICmp->getOperand(1 - IVOperIdx), ICmpLoop);
 
+  bool IsExitCond = false;
+  if (ICmp == L->getLatchCmpInst())
+    IsExitCond = true;
   // If the condition is always true or always false in the given context,
   // replace it with a constant value.
   SmallVector<Instruction *, 4> Users;
@@ -276,6 +279,8 @@ void SimplifyIndvar::eliminateIVComparison(ICmpInst *ICmp,
     SE->forgetValue(ICmp);
     ICmp->replaceAllUsesWith(ConstantInt::getBool(ICmp->getContext(), *Ev));
     DeadInsts.emplace_back(ICmp);
+    if (IsExitCond)
+      SE->forgetLoop(L);
     LLVM_DEBUG(dbgs() << "INDVARS: Eliminated comparison: " << *ICmp << '\n');
     ++NumElimCmp;
     Changed = true;
diff --git a/llvm/test/Transforms/IndVarSimplify/eliminate-exit-comparison.ll b/llvm/test/Transforms/IndVarSimplify/eliminate-exit-comparison.ll
index 388ffdca064bd..21767c92fd494 100644
--- a/llvm/test/Transforms/IndVarSimplify/eliminate-exit-comparison.ll
+++ b/llvm/test/Transforms/IndVarSimplify/eliminate-exit-comparison.ll
@@ -2,13 +2,12 @@
 ; RUN: opt -passes='loop(indvars),print<scalar-evolution>' -S -disable-output < %s 2>&1 | FileCheck %s
 
 ; CHECK:  Determining loop execution counts for: @combined_bridge
-; CHECK-NEXT:  Loop %inner2.ph.i: backedge-taken count is i64 -1
-; CHECK-NEXT:  Loop %inner2.ph.i: constant max backedge-taken count is i64 -1
-; CHECK-NEXT:  Loop %inner2.ph.i: symbolic max backedge-taken count is i64 -1
-; CHECK-NEXT:  Loop %inner2.ph.i: Trip multiple is 2147483648
-; CHECK-NEXT:  Loop %inner1.ph.i: backedge-taken count is i64 -1
-; CHECK-NEXT:  Loop %inner1.ph.i: constant max backedge-taken count is i64 -1
-; CHECK-NEXT:  Loop %inner1.ph.i: symbolic max backedge-taken count is i64 -1
+; CHECK-NEXT:  Loop %inner2.ph.i: Unpredictable backedge-taken count.
+; CHECK-NEXT:  Loop %inner2.ph.i: Unpredictable constant max backedge-taken count.
+; CHECK-NEXT:  Loop %inner2.ph.i: Unpredictable symbolic max backedge-taken count.
+; CHECK-NEXT:  Loop %inner1.ph.i: Unpredictable backedge-taken count.
+; CHECK-NEXT:  Loop %inner1.ph.i: Unpredictable constant max backedge-taken count.
+; CHECK-NEXT:  Loop %inner1.ph.i: Unpredictable symbolic max backedge-taken count.
 
 define i64 @combined_bridge() {
 
diff --git a/llvm/test/Transforms/IndVarSimplify/invalidate-modified-lcssa-phi.ll b/llvm/test/Transforms/IndVarSimplify/invalidate-modified-lcssa-phi.ll
index 72c292a5f2bcf..e8a3dcbc22286 100644
--- a/llvm/test/Transforms/IndVarSimplify/invalidate-modified-lcssa-phi.ll
+++ b/llvm/test/Transforms/IndVarSimplify/invalidate-modified-lcssa-phi.ll
@@ -170,7 +170,7 @@ define i32 @pr58750(i16 %a, ptr %dst, i1 %c.0) {
 ; CHECK-NEXT:    br label [[INNER:%.*]]
 ; CHECK:       inner:
 ; CHECK-NEXT:    store i16 0, ptr [[DST:%.*]], align 1
-; CHECK-NEXT:    br i1 false, label [[INNER]], label [[OUTER_LATCH]]
+; CHECK-NEXT:    br label [[OUTER_LATCH]]
 ; CHECK:       outer.latch:
 ; CHECK-NEXT:    [[LCSSA]] = phi i32 [ [[XOR]], [[INNER]] ]
 ; CHECK-NEXT:    br i1 [[C_0:%.*]], label [[OUTER_HEADER]], label [[EXIT:%.*]]
diff --git a/llvm/test/Transforms/IndVarSimplify/pr55689.ll b/llvm/test/Transforms/IndVarSimplify/pr55689.ll
index c5565af7f1671..78443cd45e469 100644
--- a/llvm/test/Transforms/IndVarSimplify/pr55689.ll
+++ b/llvm/test/Transforms/IndVarSimplify/pr55689.ll
@@ -1,8 +1,5 @@
 ; RUN: opt -S -passes='loop(indvars)' -verify-scev < %s | FileCheck %s
 
-; REQUIRES: asserts
-; XFAIL: *
-
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2"
 target triple = "x86_64-unknown-linux-gnu"
 
diff --git a/llvm/test/Transforms/LoopDeletion/pr53969.ll b/llvm/test/Transforms/LoopDeletion/pr53969.ll
index 45c7ee2aecbbe..751130daee35f 100644
--- a/llvm/test/Transforms/LoopDeletion/pr53969.ll
+++ b/llvm/test/Transforms/LoopDeletion/pr53969.ll
@@ -10,23 +10,48 @@ define void @test() {
 ; CHECK-NEXT:  bb:
 ; CHECK-NEXT:    br label [[BB1:%.*]]
 ; CHECK:       bb1:
+; CHECK-NEXT:    [[TMP:%.*]] = phi i32 [ undef, [[BB:%.*]] ]
+; CHECK-NEXT:    [[TMP2:%.*]] = phi i32 [ 11, [[BB]] ]
+; CHECK-NEXT:    [[TMP3:%.*]] = add nsw i32 112, -1
+; CHECK-NEXT:    [[TMP4:%.*]] = add nuw nsw i32 [[TMP2]], 1
+; CHECK-NEXT:    [[TMP5:%.*]] = mul i32 [[TMP3]], [[TMP3]]
+; CHECK-NEXT:    [[TMP6:%.*]] = mul nsw i32 [[TMP2]], -6
+; CHECK-NEXT:    [[TMP7:%.*]] = mul i32 [[TMP6]], [[TMP5]]
+; CHECK-NEXT:    [[TMP8:%.*]] = add i32 [[TMP7]], [[TMP2]]
 ; CHECK-NEXT:    [[TMP9:%.*]] = and i32 undef, 1
 ; CHECK-NEXT:    [[TMP10:%.*]] = icmp eq i32 [[TMP9]], 0
 ; CHECK-NEXT:    br i1 [[TMP10]], label [[BB33_LOOPEXIT1:%.*]], label [[BB34_PREHEADER:%.*]]
 ; CHECK:       bb34.preheader:
+; CHECK-NEXT:    [[TMP0:%.*]] = add i32 [[TMP]], 2
 ; CHECK-NEXT:    br label [[BB34:%.*]]
 ; CHECK:       bb11:
 ; CHECK-NEXT:    [[TMP2_LCSSA12:%.*]] = phi i32 [ 11, [[BB34]] ]
 ; CHECK-NEXT:    br label [[BB33_LOOPEXIT:%.*]]
 ; CHECK:       bb12:
+; CHECK-NEXT:    [[TMP41_LCSSA:%.*]] = phi i64 [ [[TMP41:%.*]], [[BB34]] ]
+; CHECK-NEXT:    [[TMP13:%.*]] = icmp eq ptr addrspace(1) undef, null
+; CHECK-NEXT:    [[TMP1:%.*]] = trunc i32 [[TMP]] to i1
+; CHECK-NEXT:    [[TMP11:%.*]] = add i1 [[TMP1]], true
 ; CHECK-NEXT:    br label [[BB14:%.*]]
 ; CHECK:       bb14:
-; CHECK-NEXT:    br i1 true, label [[BB32:%.*]], label [[BB22:%.*]]
+; CHECK-NEXT:    [[INDVARS_IV:%.*]] = phi i64 [ 4, [[BB12:%.*]] ]
+; CHECK-NEXT:    [[TMP15:%.*]] = phi i32 [ [[TMP0]], [[BB12]] ]
+; CHECK-NEXT:    [[TMP16:%.*]] = phi i64 [ [[TMP41_LCSSA]], [[BB12]] ]
+; CHECK-NEXT:    [[TMP18:%.*]] = add i64 [[TMP16]], undef
+; CHECK-NEXT:    [[LFTR_WIDEIV:%.*]] = trunc i64 [[INDVARS_IV]] to i1
+; CHECK-NEXT:    [[EXITCOND:%.*]] = icmp eq i1 [[LFTR_WIDEIV]], [[TMP11]]
+; CHECK-NEXT:    br i1 [[EXITCOND]], label [[BB32:%.*]], label [[BB22:%.*]]
 ; CHECK:       bb22:
-; CHECK-NEXT:    br i1 false, label [[BB42:%.*]], label [[BB25:%.*]]
+; CHECK-NEXT:    [[TMP12:%.*]] = trunc nuw nsw i64 [[INDVARS_IV]] to i32
+; CHECK-NEXT:    [[TMP23:%.*]] = or i32 [[TMP12]], undef
+; CHECK-NEXT:    [[TMP24:%.*]] = add i32 [[TMP23]], undef
+; CHECK-NEXT:    br i1 [[TMP13]], label [[BB42:%.*]], label [[BB25:%.*]]
 ; CHECK:       bb25:
+; CHECK-NEXT:    [[INDVARS_IV_NEXT:%.*]] = add nuw nsw i64 [[INDVARS_IV]], 1
+; CHECK-NEXT:    [[TMP29:%.*]] = add i32 [[TMP15]], 3
 ; CHECK-NEXT:    br label [[BB31:%.*]]
 ; CHECK:       bb31:
+; CHECK-NEXT:    [[TMP29_LCSSA:%.*]] = phi i32 [ [[TMP29]], [[BB25]] ]
 ; CHECK-NEXT:    unreachable
 ; CHECK:       bb32:
 ; CHECK-NEXT:    ret void
@@ -34,17 +59,22 @@ define void @test() {
 ; CHECK-NEXT:    [[TMP2_LCSSA9:%.*]] = phi i32 [ [[TMP2_LCSSA12]], [[BB11:%.*]] ]
 ; CHECK-NEXT:    br label [[BB33:%.*]]
 ; CHECK:       bb33.loopexit1:
-; CHECK-NEXT:    [[TMP2_LCSSA:%.*]] = phi i32 [ 11, [[BB1]] ]
+; CHECK-NEXT:    [[TMP2_LCSSA:%.*]] = phi i32 [ [[TMP2]], [[BB1]] ]
 ; CHECK-NEXT:    br label [[BB33]]
 ; CHECK:       bb33:
 ; CHECK-NEXT:    [[TMP210:%.*]] = phi i32 [ [[TMP2_LCSSA]], [[BB33_LOOPEXIT1]] ], [ [[TMP2_LCSSA9]], [[BB33_LOOPEXIT]] ]
 ; CHECK-NEXT:    call void @use(i32 [[TMP210]])
 ; CHECK-NEXT:    ret void
 ; CHECK:       bb34:
-; CHECK-NEXT:    br i1 false, label [[BB11]], label [[BB12:%.*]]
+; CHECK-NEXT:    [[TMP36:%.*]] = xor i32 0, [[TMP8]]
+; CHECK-NEXT:    [[TMP38:%.*]] = add i32 [[TMP36]], undef
+; CHECK-NEXT:    [[TMP39:%.*]] = add i32 [[TMP38]], undef
+; CHECK-NEXT:    [[TMP40:%.*]] = sext i32 [[TMP39]] to i64
+; CHECK-NEXT:    [[TMP41]] = add i64 undef, [[TMP40]]
+; CHECK-NEXT:    br i1 false, label [[BB11]], label [[BB12]]
 ; CHECK:       bb42:
-; CHECK-NEXT:    [[TMP24_LCSSA:%.*]] = phi i32 [ undef, [[BB22]] ]
-; CHECK-NEXT:    [[TMP18_LCSSA4:%.*]] = phi i64 [ undef, [[BB22]] ]
+; CHECK-NEXT:    [[TMP24_LCSSA:%.*]] = phi i32 [ [[TMP24]], [[BB22]] ]
+; CHECK-NEXT:    [[TMP18_LCSSA4:%.*]] = phi i64 [ [[TMP18]], [[BB22]] ]
 ; CHECK-NEXT:    store atomic i64 [[TMP18_LCSSA4]], ptr addrspace(1) undef unordered, align 8
 ; CHECK-NEXT:    call void @use(i32 [[TMP24_LCSSA]])
 ; CHECK-NEXT:    ret void
diff --git a/llvm/test/Transforms/LoopUnroll/scevunroll.ll b/llvm/test/Transforms/LoopUnroll/scevunroll.ll
index 5375524f35237..eae7f58354081 100644
--- a/llvm/test/Transforms/LoopUnroll/scevunroll.ll
+++ b/llvm/test/Transforms/LoopUnroll/scevunroll.ll
@@ -320,7 +320,7 @@ define void @nsw_latch(ptr %a) nounwind {
 ; CHECK:       for.cond.1:
 ; CHECK-NEXT:    br label [[RETURN]]
 ; CHECK:       return:
-; CHECK-NEXT:    [[B_03_LCSSA:%.*]] = phi i32 [ 0, [[FOR_COND_1]] ], [ 0, [[FOR_COND]] ], [ 8, [[FOR_BODY_1]] ]
+; CHECK-NEXT:    [[B_03_LCSSA:%.*]] = phi i32 [ 8, [[FOR_COND_1]] ], [ 8, [[FOR_COND]] ], [ 8, [[FOR_BODY_1]] ]
 ; CHECK-NEXT:    [[RETVAL_0:%.*]] = phi i32 [ 0, [[FOR_COND_1]] ], [ 0, [[FOR_COND]] ], [ 1, [[FOR_BODY_1]] ]
 ; CHECK-NEXT:    store i32 [[B_03_LCSSA]], ptr [[A:%.*]], align 4
 ; CHECK-NEXT:    ret void

>From 997a2036e1271106c88e840afa19ef0f99848845 Mon Sep 17 00:00:00 2001
From: Hassnaa Hamdi <hassnaa.hamdi at arm.com>
Date: Thu, 6 Aug 2026 03:52:11 +0100
Subject: [PATCH 3/3] - forget top most loop including contained loops." -
 update SCEV for any exit cond.

---
 llvm/lib/Transforms/Utils/SimplifyIndVar.cpp  | 10 ++++++----
 llvm/test/Transforms/LoopUnroll/scevunroll.ll | 12 ++++++------
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
index 88a124f43b34c..27527539aba87 100644
--- a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
@@ -267,20 +267,22 @@ void SimplifyIndvar::eliminateIVComparison(ICmpInst *ICmp,
   const SCEV *X = SE->getSCEVAtScope(ICmp->getOperand(1 - IVOperIdx), ICmpLoop);
 
   bool IsExitCond = false;
-  if (ICmp == L->getLatchCmpInst())
-    IsExitCond = true;
   // If the condition is always true or always false in the given context,
   // replace it with a constant value.
   SmallVector<Instruction *, 4> Users;
-  for (auto *U : ICmp->users())
+  for (auto *U : ICmp->users()) {
     Users.push_back(cast<Instruction>(U));
+    if (isa<CondBrInst>(U))
+      IsExitCond = true;
+  }
   const Instruction *CtxI = findCommonDominator(Users, *DT);
   if (auto Ev = SE->evaluatePredicateAt(Pred, S, X, CtxI)) {
     SE->forgetValue(ICmp);
     ICmp->replaceAllUsesWith(ConstantInt::getBool(ICmp->getContext(), *Ev));
     DeadInsts.emplace_back(ICmp);
     if (IsExitCond)
-      SE->forgetLoop(L);
+      SE->forgetTopmostLoop(L);
+
     LLVM_DEBUG(dbgs() << "INDVARS: Eliminated comparison: " << *ICmp << '\n');
     ++NumElimCmp;
     Changed = true;
diff --git a/llvm/test/Transforms/LoopUnroll/scevunroll.ll b/llvm/test/Transforms/LoopUnroll/scevunroll.ll
index eae7f58354081..f8abb7391f24c 100644
--- a/llvm/test/Transforms/LoopUnroll/scevunroll.ll
+++ b/llvm/test/Transforms/LoopUnroll/scevunroll.ll
@@ -172,7 +172,7 @@ define i32 @multiExitIncomplete(ptr %base) nounwind {
 ; CHECK-NEXT:    [[VAL:%.*]] = load i32, ptr [[BASE:%.*]], align 4
 ; CHECK-NEXT:    br label [[L2:%.*]]
 ; CHECK:       l2:
-; CHECK-NEXT:    br label [[L3:%.*]]
+; CHECK-NEXT:    br i1 true, label [[L3:%.*]], label [[EXIT2:%.*]]
 ; CHECK:       l3:
 ; CHECK-NEXT:    [[CMP3:%.*]] = icmp ne i32 [[VAL]], 0
 ; CHECK-NEXT:    br i1 [[CMP3]], label [[L1_1:%.*]], label [[EXIT3:%.*]]
@@ -181,7 +181,7 @@ define i32 @multiExitIncomplete(ptr %base) nounwind {
 ; CHECK-NEXT:    [[VAL_1:%.*]] = load i32, ptr [[ADR_1]], align 4
 ; CHECK-NEXT:    br label [[L2_1:%.*]]
 ; CHECK:       l2.1:
-; CHECK-NEXT:    br label [[L3_1:%.*]]
+; CHECK-NEXT:    br i1 true, label [[L3_1:%.*]], label [[EXIT2]]
 ; CHECK:       l3.1:
 ; CHECK-NEXT:    [[CMP3_1:%.*]] = icmp ne i32 [[VAL_1]], 0
 ; CHECK-NEXT:    br i1 [[CMP3_1]], label [[L1_2:%.*]], label [[EXIT3]]
@@ -190,7 +190,7 @@ define i32 @multiExitIncomplete(ptr %base) nounwind {
 ; CHECK-NEXT:    [[VAL_2:%.*]] = load i32, ptr [[ADR_2]], align 4
 ; CHECK-NEXT:    br label [[L2_2:%.*]]
 ; CHECK:       l2.2:
-; CHECK-NEXT:    br label [[L3_2:%.*]]
+; CHECK-NEXT:    br i1 true, label [[L3_2:%.*]], label [[EXIT2]]
 ; CHECK:       l3.2:
 ; CHECK-NEXT:    [[CMP3_2:%.*]] = icmp ne i32 [[VAL_2]], 0
 ; CHECK-NEXT:    br i1 [[CMP3_2]], label [[L1_3:%.*]], label [[EXIT3]]
@@ -199,7 +199,7 @@ define i32 @multiExitIncomplete(ptr %base) nounwind {
 ; CHECK-NEXT:    [[VAL_3:%.*]] = load i32, ptr [[ADR_3]], align 4
 ; CHECK-NEXT:    br label [[L2_3:%.*]]
 ; CHECK:       l2.3:
-; CHECK-NEXT:    br label [[L3_3:%.*]]
+; CHECK-NEXT:    br i1 true, label [[L3_3:%.*]], label [[EXIT2]]
 ; CHECK:       l3.3:
 ; CHECK-NEXT:    [[CMP3_3:%.*]] = icmp ne i32 [[VAL_3]], 0
 ; CHECK-NEXT:    br i1 [[CMP3_3]], label [[L1_4:%.*]], label [[EXIT3]]
@@ -208,14 +208,14 @@ define i32 @multiExitIncomplete(ptr %base) nounwind {
 ; CHECK-NEXT:    [[VAL_4:%.*]] = load i32, ptr [[ADR_4]], align 4
 ; CHECK-NEXT:    br label [[L2_4:%.*]]
 ; CHECK:       l2.4:
-; CHECK-NEXT:    br label [[L3_4:%.*]]
+; CHECK-NEXT:    br i1 true, label [[L3_4:%.*]], label [[EXIT2]]
 ; CHECK:       l3.4:
 ; CHECK-NEXT:    [[CMP3_4:%.*]] = icmp ne i32 [[VAL_4]], 0
 ; CHECK-NEXT:    br i1 [[CMP3_4]], label [[L1_5:%.*]], label [[EXIT3]]
 ; CHECK:       l1.5:
 ; CHECK-NEXT:    br i1 false, label [[L2_5:%.*]], label [[EXIT1:%.*]]
 ; CHECK:       l2.5:
-; CHECK-NEXT:    br i1 true, label [[L3_5:%.*]], label [[EXIT2:%.*]]
+; CHECK-NEXT:    br i1 true, label [[L3_5:%.*]], label [[EXIT2]]
 ; CHECK:       l3.5:
 ; CHECK-NEXT:    br label [[EXIT3]]
 ; CHECK:       exit1:



More information about the llvm-commits mailing list