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
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
  159
  160
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py

; The tests in this file check that we do not simplify based on metadata that is
; not available on all code paths.

; RUN: opt < %s -S -newgvn | FileCheck %s

define i1 @test1(i32** %arg, i1 %arg2) {
; CHECK-LABEL: @test1(
; CHECK-NEXT:    br i1 [[ARG2:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
; CHECK:       bb1:
; CHECK-NEXT:    [[LOAD1:%.*]] = load i32*, i32** [[ARG:%.*]], !nonnull !0
; CHECK-NEXT:    [[CMP1:%.*]] = icmp eq i32* [[LOAD1]], null
; CHECK-NEXT:    ret i1 [[CMP1]]
; CHECK:       bb2:
; CHECK-NEXT:    [[LOAD2:%.*]] = load i32*, i32** [[ARG]]
; CHECK-NEXT:    [[CMP2:%.*]] = icmp eq i32* [[LOAD2]], null
; CHECK-NEXT:    ret i1 [[CMP2]]
;
  br i1 %arg2, label %bb1, label %bb2

bb1:
  %load1 = load i32*, i32** %arg, !nonnull !0
  %cmp1 = icmp eq i32* %load1, null
  ret i1 %cmp1

bb2:
  %load2 = load i32*, i32** %arg
  %cmp2 = icmp eq i32* %load2, null
  ret i1 %cmp2
}

define i1 @test2(i32** %arg, i1 %arg2) {
; CHECK-LABEL: @test2(
; CHECK-NEXT:    br i1 [[ARG2:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
; CHECK:       bb1:
; CHECK-NEXT:    [[LOAD1:%.*]] = load i32*, i32** [[ARG:%.*]]
; CHECK-NEXT:    [[CMP1:%.*]] = icmp eq i32* [[LOAD1]], null
; CHECK-NEXT:    ret i1 [[CMP1]]
; CHECK:       bb2:
; CHECK-NEXT:    [[LOAD2:%.*]] = load i32*, i32** [[ARG]], !nonnull !0
; CHECK-NEXT:    [[CMP2:%.*]] = icmp eq i32* [[LOAD2]], null
; CHECK-NEXT:    ret i1 [[CMP2]]
;
  br i1 %arg2, label %bb1, label %bb2

bb1:
  %load1 = load i32*, i32** %arg
  %cmp1 = icmp eq i32* %load1, null
  ret i1 %cmp1

bb2:
  %load2 = load i32*, i32** %arg, !nonnull !0
  %cmp2 = icmp eq i32* %load2, null
  ret i1 %cmp2
}


define i1 @test3(i32* %ptr, i1 %arg2) {
; CHECK-LABEL: @test3(
; CHECK-NEXT:    br i1 [[ARG2:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
; CHECK:       bb1:
; CHECK-NEXT:    [[LOAD1:%.*]] = load i32, i32* [[PTR:%.*]], !range !1
; CHECK-NEXT:    [[CMP1:%.*]] = icmp ne i32 [[LOAD1]], 999
; CHECK-NEXT:    ret i1 [[CMP1]]
; CHECK:       bb2:
; CHECK-NEXT:    [[LOAD2:%.*]] = load i32, i32* [[PTR]]
; CHECK-NEXT:    [[CMP2:%.*]] = icmp ne i32 [[LOAD2]], 999
; CHECK-NEXT:    ret i1 [[CMP2]]
;
  br i1 %arg2, label %bb1, label %bb2

bb1:
  %load1 = load i32, i32* %ptr, !range !1
  %cmp1 = icmp ne i32 %load1, 999
  ret i1 %cmp1

bb2:
  %load2 = load i32, i32* %ptr
  %cmp2 = icmp ne i32 %load2, 999
  ret i1 %cmp2
}

define i1 @test4(i32* %ptr, i1 %arg2) {
; CHECK-LABEL: @test4(
; CHECK-NEXT:    br i1 [[ARG2:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
; CHECK:       bb1:
; CHECK-NEXT:    [[LOAD1:%.*]] = load i32, i32* [[PTR:%.*]]
; CHECK-NEXT:    [[CMP1:%.*]] = icmp ne i32 [[LOAD1]], 999
; CHECK-NEXT:    ret i1 [[CMP1]]
; CHECK:       bb2:
; CHECK-NEXT:    [[LOAD2:%.*]] = load i32, i32* [[PTR]], !range !1
; CHECK-NEXT:    [[CMP2:%.*]] = icmp ne i32 [[LOAD2]], 999
; CHECK-NEXT:    ret i1 [[CMP2]]
;
  br i1 %arg2, label %bb1, label %bb2

bb1:
  %load1 = load i32, i32* %ptr
  %cmp1 = icmp ne i32 %load1, 999
  ret i1 %cmp1

bb2:
  %load2 = load i32, i32* %ptr, !range !1
  %cmp2 = icmp ne i32 %load2, 999
  ret i1 %cmp2
}

define i1 @test5(i32* %ptr, i1 %arg2) {
; CHECK-LABEL: @test5(
; CHECK-NEXT:    br i1 [[ARG2:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
; CHECK:       bb1:
; CHECK-NEXT:    [[LOAD1:%.*]] = load i32, i32* [[PTR:%.*]], !range !1
; CHECK-NEXT:    [[CMP1:%.*]] = icmp slt i32 [[LOAD1]], 999
; CHECK-NEXT:    ret i1 [[CMP1]]
; CHECK:       bb2:
; CHECK-NEXT:    [[LOAD2:%.*]] = load i32, i32* [[PTR]]
; CHECK-NEXT:    [[CMP2:%.*]] = icmp slt i32 [[LOAD2]], 999
; CHECK-NEXT:    ret i1 [[CMP2]]
;
  br i1 %arg2, label %bb1, label %bb2

bb1:
  %load1 = load i32, i32* %ptr, !range !1
  %cmp1 = icmp slt i32 %load1, 999
  ret i1 %cmp1

bb2:
  %load2 = load i32, i32* %ptr
  %cmp2 = icmp slt i32 %load2, 999
  ret i1 %cmp2
}

define i1 @test6(i32* %ptr, i1 %arg2) {
; CHECK-LABEL: @test6(
; CHECK-NEXT:    br i1 [[ARG2:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
; CHECK:       bb1:
; CHECK-NEXT:    [[LOAD1:%.*]] = load i32, i32* [[PTR:%.*]]
; CHECK-NEXT:    [[CMP1:%.*]] = icmp slt i32 [[LOAD1]], 999
; CHECK-NEXT:    ret i1 [[CMP1]]
; CHECK:       bb2:
; CHECK-NEXT:    [[LOAD2:%.*]] = load i32, i32* [[PTR]], !range !1
; CHECK-NEXT:    [[CMP2:%.*]] = icmp slt i32 [[LOAD2]], 999
; CHECK-NEXT:    ret i1 [[CMP2]]
;
  br i1 %arg2, label %bb1, label %bb2

bb1:
  %load1 = load i32, i32* %ptr
  %cmp1 = icmp slt i32 %load1, 999
  ret i1 %cmp1

bb2:
  %load2 = load i32, i32* %ptr, !range !1
  %cmp2 = icmp slt i32 %load2, 999
  ret i1 %cmp2
}

!0 = !{}
!1 = !{ i32 10, i32 20 }