1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -verify-scev -passes="print<scalar-evolution>,loop-simplifycfg" -S %s 2>&1 | FileCheck %s
4 ; print<scalar-evolution> is used to compute SCEVs for all values & loops in
7 define void @test_pr58262(ptr %src) {
8 ; CHECK-LABEL: @test_pr58262(
10 ; CHECK-NEXT: br label [[LOOP_1_HEADER:%.*]]
11 ; CHECK: loop.1.header.loopexit:
12 ; CHECK-NEXT: br label [[LOOP_1_HEADER]]
13 ; CHECK: loop.1.header:
14 ; CHECK-NEXT: switch i32 0, label [[LOOP_1_HEADER_SPLIT:%.*]] [
15 ; CHECK-NEXT: i32 1, label [[LOOP_1_HEADER_LOOPEXIT:%.*]]
17 ; CHECK: loop.1.header.split:
18 ; CHECK-NEXT: br label [[LOOP_2_HEADER:%.*]]
19 ; CHECK: loop.2.header:
20 ; CHECK-NEXT: call void @clobber()
21 ; CHECK-NEXT: [[L:%.*]] = load i16, ptr [[SRC:%.*]], align 1
22 ; CHECK-NEXT: [[C:%.*]] = icmp ult i16 0, [[L]]
23 ; CHECK-NEXT: br i1 [[C]], label [[TRAP:%.*]], label [[LOOP_2_LATCH:%.*]]
24 ; CHECK: loop.2.latch:
25 ; CHECK-NEXT: br label [[LOOP_2_HEADER]]
27 ; CHECK-NEXT: ret void
30 br label %loop.1.header
33 br label %loop.2.header
36 br i1 true, label %then, label %loop.1.header
40 %l = load i16, ptr %src, align 1
41 %c = icmp ult i16 0, %l
42 br i1 %c, label %trap, label %loop.2.latch
45 br label %loop.2.header
47 trap: ; preds = %for.body
51 declare void @clobber()