reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
; RUN: opt < %s -correlated-propagation -S | FileCheck %s

; CHECK-LABEL: @test_nop
define void @test_nop(i32 %n) {
; CHECK udiv i32 %n, 100
  %div = udiv i32 %n, 100
  ret void
}

; CHECK-LABEL: @test1(
define void @test1(i32 %n) {
entry:
  %cmp = icmp ule i32 %n, 65535
  br i1 %cmp, label %bb, label %exit

bb:
; CHECK: urem i16
  %div = urem i32 %n, 100
  br label %exit

exit:
  ret void
}

; CHECK-LABEL: @test2(
define void @test2(i32 %n) {
entry:
  %cmp = icmp ule i32 %n, 65536
  br i1 %cmp, label %bb, label %exit

bb:
; CHECK: urem i32 %n, 100
  %div = urem i32 %n, 100
  br label %exit

exit:
  ret void
}

; CHECK-LABEL: @test3(
define void @test3(i32 %m, i32 %n) {
entry:
  %cmp1 = icmp ult i32 %m, 65535
  %cmp2 = icmp ult i32 %n, 65535
  %cmp = and i1 %cmp1, %cmp2
  br i1 %cmp, label %bb, label %exit

bb:
; CHECK: urem i16
  %div = urem i32 %m, %n
  br label %exit

exit:
  ret void
}

; CHECK-LABEL: @test4(
define void @test4(i32 %m, i32 %n) {
entry:
  %cmp1 = icmp ult i32 %m, 65535
  %cmp2 = icmp ule i32 %n, 65536
  %cmp = and i1 %cmp1, %cmp2
  br i1 %cmp, label %bb, label %exit

bb:
; CHECK: urem i32 %m, %n
  %div = urem i32 %m, %n
  br label %exit

exit:
  ret void
}

; CHECK-LABEL: @test5
define void @test5(i32 %n) {
  %trunc = and i32 %n, 63
  ; CHECK: urem i8
  %div = urem i32 %trunc, 42
  ret void
}

; CHECK-LABEL: @test6
define void @test6(i32 %n) {
entry:
  %cmp = icmp ule i32 %n, 255
  br i1 %cmp, label %bb, label %exit

bb:
; CHECK: urem i8
  %div = srem i32 %n, 100
  br label %exit

exit:
  ret void
}

; CHECK-LABEL: @non_power_of_2
define void @non_power_of_2(i24 %n) {
  %div = urem i24 %n, 42
  ret void
}