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
; RUN: opt < %s -passes='print<phi-values>' -disable-output 2>&1 | FileCheck %s

; This test uses a long chain of phis that take themselves as an operand, which causes
; phi values analysis to segfault if it's not careful about that kind of thing.

; CHECK-LABEL: PHI Values for function: fn
define void @fn(i32* %arg) {
entry:
  br label %while1.cond

while1.cond:
; CHECK: PHI %phi1 has values:
; CHECK: i32* %arg
  %phi1 = phi i32* [ %arg, %entry ], [ %phi2, %while1.then ]
  br i1 undef, label %while1.end, label %while1.body

while1.body:
  br i1 undef, label %while1.then, label %while1.if

while1.if:
  br label %while1.then

while1.then:
; CHECK: PHI %phi2 has values:
; CHECK: i32* %arg
  %phi2 = phi i32* [ %arg, %while1.if ], [ %phi1, %while1.body ]
  br label %while1.cond

while1.end:
  br label %while2.cond1

while2.cond1:
; CHECK: PHI %phi3 has values:
; CHECK: i32* %arg
  %phi3 = phi i32* [ %phi1, %while1.end ], [ %phi5, %while2.then ]
  br i1 undef, label %while2.end, label %while2.body1

while2.body1:
  br i1 undef, label %while2.cond2, label %while2.then

while2.cond2:
; CHECK: PHI %phi4 has values:
; CHECK: i32* %arg
  %phi4 = phi i32* [ %phi3, %while2.body1 ], [ %phi4, %while2.if ]
  br i1 undef, label %while2.then, label %while2.if

while2.if:
  br label %while2.cond2

while2.then:
; CHECK: PHI %phi5 has values:
; CHECK: i32* %arg
  %phi5 = phi i32* [ %phi3, %while2.body1 ], [ %phi4, %while2.cond2 ]
  br label %while2.cond1

while2.end:
  br label %while3.cond1

while3.cond1:
; CHECK: PHI %phi6 has values:
; CHECK: i32* %arg
  %phi6 = phi i32* [ %phi3, %while2.end ], [ %phi7, %while3.cond2 ]
  br i1 undef, label %while3.end, label %while3.cond2

while3.cond2:
; CHECK: PHI %phi7 has values:
; CHECK: i32* %arg
  %phi7 = phi i32* [ %phi6, %while3.cond1 ], [ %phi7, %while3.body ]
  br i1 undef, label %while3.cond1, label %while3.body

while3.body:
  br label %while3.cond2

while3.end:
  br label %while4.cond1

while4.cond1:
; CHECK: PHI %phi8 has values:
; CHECK: i32* %arg
  %phi8 = phi i32* [ %phi6, %while3.end ], [ %phi10, %while4.then ]
  br i1 undef, label %while4.end, label %while4.if

while4.if:
  br i1 undef, label %while4.cond2, label %while4.then

while4.cond2:
; CHECK: PHI %phi9 has values:
; CHECK: i32* %arg
  %phi9 = phi i32* [ %phi8, %while4.if ], [ %phi9, %while4.body ]
  br i1 undef, label %while4.then, label %while4.body

while4.body:
  br label %while4.cond2

while4.then:
; CHECK: PHI %phi10 has values:
; CHECK: i32* %arg
  %phi10 = phi i32* [ %phi8, %while4.if ], [ %phi9, %while4.cond2 ]
  br label %while4.cond1

while4.end:
  br label %while5.cond

while5.cond:
; CHECK: PHI %phi11 has values:
; CHECK: i32* %arg
  %phi11 = phi i32* [ %phi8, %while4.end ], [ %phi13, %while5.then ]
  br i1 undef, label %while5.end, label %while5.body1

while5.body1:
  br i1 undef, label %while5.if, label %while5.then

while5.if:
; CHECK: PHI %phi12 has values:
; CHECK: i32* %arg
  %phi12 = phi i32* [ %phi11, %while5.body1 ], [ %phi12, %while5.body2 ]
  br i1 undef, label %while5.then, label %while5.body2

while5.body2:
  br label %while5.if

while5.then:
; CHECK: PHI %phi13 has values:
; CHECK: i32* %arg
  %phi13 = phi i32* [ %phi11, %while5.body1 ], [ %phi12, %while5.if ]
  br label %while5.cond

while5.end:
  br label %while6.cond1

while6.cond1:
; CHECK: PHI %phi14 has values:
; CHECK: i32* %arg
  %phi14 = phi i32* [ %phi11, %while5.end ], [ %phi14, %while6.cond1 ]
  br i1 undef, label %while6.cond2, label %while6.cond1

while6.cond2:
; CHECK: PHI %phi15 has values:
; CHECK: i32* %arg
  %phi15 = phi i32* [ %phi14, %while6.cond1 ], [ %phi15, %while6.cond2 ]
  br label %while6.cond2
}