1 ; RUN: opt < %s -passes=correlated-propagation -S | FileCheck %s
3 ; Check that debug locations are preserved. For more info see:
4 ; https://llvm.org/docs/SourceLevelDebugging.html#fixing-errors
5 ; RUN: opt < %s -enable-debugify -passes=correlated-propagation -S 2>&1 | \
6 ; RUN: FileCheck %s -check-prefix=DEBUG
7 ; DEBUG: CheckModuleDebugify: PASS
9 ; CHECK-LABEL: @test_nop
10 define void @test_nop(i32 %n) {
11 ; CHECK: udiv i32 %n, 100
12 %div = udiv i32 %n, 100
16 ; CHECK-LABEL: @test1(
17 define void @test1(i32 %n) {
19 %cmp = icmp ule i32 %n, 65535
20 br i1 %cmp, label %bb, label %exit
24 %div = udiv i32 %n, 100
31 ; CHECK-LABEL: @test2(
32 define void @test2(i32 %n) {
34 %cmp = icmp ule i32 %n, 65536
35 br i1 %cmp, label %bb, label %exit
38 ; CHECK: udiv i32 %n, 100
39 %div = udiv i32 %n, 100
46 ; CHECK-LABEL: @test3(
47 define void @test3(i32 %m, i32 %n) {
49 %cmp1 = icmp ult i32 %m, 65535
50 %cmp2 = icmp ult i32 %n, 65535
51 %cmp = and i1 %cmp1, %cmp2
52 br i1 %cmp, label %bb, label %exit
56 %div = udiv i32 %m, %n
63 ; CHECK-LABEL: @test4(
64 define void @test4(i32 %m, i32 %n) {
66 %cmp1 = icmp ult i32 %m, 65535
67 %cmp2 = icmp ule i32 %n, 65536
68 %cmp = and i1 %cmp1, %cmp2
69 br i1 %cmp, label %bb, label %exit
72 ; CHECK: udiv i32 %m, %n
73 %div = udiv i32 %m, %n
81 define void @test5(i32 %n) {
82 %trunc = and i32 %n, 65535
84 %div = udiv i32 %trunc, 42
89 define void @test6(i32 %n) {
91 %cmp = icmp ule i32 %n, 255
92 br i1 %cmp, label %bb, label %exit
96 %div = sdiv i32 %n, 100