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 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
|
; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
; CHECK: Entry or anchor intrinsic cannot have a convergencectrl token operand.
; CHECK-NEXT: %t04_tok2 = call token
; CHECK: Loop intrinsic must have a convergencectrl token operand.
; CHECK-NEXT: %t04_tok3 = call token
define void @basic_syntax() {
%t04_tok1 = call token @llvm.experimental.convergence.anchor()
%t04_tok2 = call token @llvm.experimental.convergence.anchor() [ "convergencectrl"(token %t04_tok1) ]
%t04_tok3 = call token @llvm.experimental.convergence.loop()
ret void
}
; CHECK: Convergence control tokens can only be produced by calls to the convergence control intrinsics.
; CHECK-NEXT: %t04_tok1 = call token @produce_token()
; CHECK-NEXT: call void @f() [ "convergencectrl"(token %t04_tok1) ]
define void @wrong_token() {
%t04_tok1 = call token @produce_token()
call void @f() [ "convergencectrl"(token %t04_tok1) ]
ret void
}
; CHECK: Convergence control token can only be used in a convergent call.
; CHECK-NEXT call void @g(){{.*}}%t05_tok1
define void @missing.attribute() {
%t05_tok1 = call token @llvm.experimental.convergence.anchor()
call void @g() [ "convergencectrl"(token %t05_tok1) ]
ret void
}
; CHECK: The 'convergencectrl' bundle requires exactly one token use.
; CHECK-NEXT: call void @g()
define void @multiple_tokens() {
%t06_tok1 = call token @llvm.experimental.convergence.anchor()
%t06_tok2 = call token @llvm.experimental.convergence.anchor()
call void @g() [ "convergencectrl"(token %t06_tok2, token %t06_tok1) ]
ret void
}
; CHECK: The 'convergencectrl' bundle can occur at most once on a call
; CHECK-NEXT: call void @g()
define void @multiple_bundles() {
%t07_tok1 = call token @llvm.experimental.convergence.anchor()
%t07_tok2 = call token @llvm.experimental.convergence.anchor()
call void @g() [ "convergencectrl"(token %t07_tok2), "convergencectrl"(token %t07_tok1) ]
ret void
}
; CHECK: Cannot mix controlled and uncontrolled convergence in the same function
; CHECK-NEXT call void @f()
define void @mixed1() {
call void @g() ; not convergent
%t10_tok1 = call token @llvm.experimental.convergence.anchor()
call void @f() [ "convergencectrl"(token %t10_tok1) ]
call void @g()
call void @f() ; uncontrolled convergent
ret void
}
; CHECK: Cannot mix controlled and uncontrolled convergence in the same function
; CHECK: %t20_tok1 = call token @llvm.experimental.convergence.anchor()
; CHECK: Cannot mix controlled and uncontrolled convergence in the same function
; CHECK: call void @f() [ "convergencectrl"(token %t20_tok1) ]
define void @mixed2() {
call void @g() ; not convergent
call void @f() ; uncontrolled convergent
call void @g()
%t20_tok1 = call token @llvm.experimental.convergence.anchor()
call void @f() [ "convergencectrl"(token %t20_tok1) ]
ret void
}
; CHECK: Convergence region is not well-nested.
; CHECK: %t30_tok2
define void @region_nesting1() {
%t30_tok1 = call token @llvm.experimental.convergence.anchor()
%t30_tok2 = call token @llvm.experimental.convergence.anchor()
call void @f() [ "convergencectrl"(token %t30_tok1) ]
call void @f() [ "convergencectrl"(token %t30_tok2) ]
ret void
}
; CHECK: Convergence region is not well-nested.
; CHECK: %t40_tok2
define void @region_nesting2(i1 %cond) {
A:
%t40_tok1 = call token @llvm.experimental.convergence.anchor()
%t40_tok2 = call token @llvm.experimental.convergence.anchor()
br i1 %cond, label %B, label %C
B:
call void @f() [ "convergencectrl"(token %t40_tok1) ]
br label %C
C:
call void @f() [ "convergencectrl"(token %t40_tok2) ]
ret void
}
; CHECK: Convergence token used by an instruction other than llvm.experimental.convergence.loop in a cycle that does not contain the token's definition.
; CHECK: token %t50_tok1
define void @use_in_cycle() {
A:
%t50_tok1 = call token @llvm.experimental.convergence.anchor()
br label %B
B:
call void @f() [ "convergencectrl"(token %t50_tok1) ]
br label %B
}
; CHECK: Entry intrinsic cannot be preceded by a convergent operation in the same basic block.
; CHECK: %t60_tok1
define void @entry_at_start(i32 %x, i32 %y) convergent {
%z = add i32 %x, %y
call void @f()
%t60_tok1 = call token @llvm.experimental.convergence.entry()
ret void
}
; CHECK: Entry intrinsic can occur only in a convergent function.
; CHECK: %t60_tok2
define void @entry_in_convergent(i32 %x, i32 %y) {
%t60_tok2 = call token @llvm.experimental.convergence.entry()
ret void
}
; CHECK: Loop intrinsic cannot be preceded by a convergent operation in the same basic block.
; CHECK-NEXT: %h1
; CHECK-SAME: %t60_tok3
define void @loop_at_start(i32 %x, i32 %y) convergent {
A:
%t60_tok3 = call token @llvm.experimental.convergence.entry()
br label %B
B:
%z = add i32 %x, %y
; This is not an error
%h2 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %t60_tok3) ]
br label %C
C:
call void @f()
%h1 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %t60_tok3) ]
ret void
}
; CHECK: Entry intrinsic can occur only in the entry block.
; CHECK: %t60_tok4
define void @entry_at_entry(i32 %x, i32 %y) convergent {
A:
%z = add i32 %x, %y
br label %B
B:
%t60_tok4 = call token @llvm.experimental.convergence.entry()
ret void
}
; CHECK: Two static convergence token uses in a cycle that does not contain either token's definition.
; CHECK: token %t70_tok1
; CHECK: token %t70_tok2
define void @multiple_hearts() {
A:
%t70_tok1 = call token @llvm.experimental.convergence.anchor()
%t70_tok2 = call token @llvm.experimental.convergence.anchor()
br label %B
B:
%h2 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %t70_tok2) ]
%h1 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %t70_tok1) ]
br label %B
}
; CHECK: Two static convergence token uses in a cycle that does not contain either token's definition.
; CHECK: token %h0
; CHECK: token %h0
define void @multiple_hearts_nested(i1 %cond1, i1 %cond2) {
A:
%t70_tok3 = call token @llvm.experimental.convergence.anchor()
br label %B
B:
%h0 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %t70_tok3) ]
br i1 %cond1, label %C, label %B
C:
%h1 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %h0) ]
%h2 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %h0) ]
br i1 %cond2, label %C, label %B
}
; CHECK: Cycle heart must dominate all blocks in the cycle.
; CHECK: %h3 = call token
; CHECK: label %C
define void @invalid_heart_nested(i1 %cond1, i1 %cond2) {
A:
%t70_tok4 = call token @llvm.experimental.convergence.anchor()
br label %B
B:
br i1 %cond1, label %C, label %B
C:
%h3 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %t70_tok4) ]
br i1 %cond2, label %C, label %B
}
; CHECK: Cycle heart must dominate all blocks in the cycle.
; CHECK: %h4 = call token
; CHECK: label %C
define void @irreducible1(i1 %cond) {
A:
%a = call token @llvm.experimental.convergence.anchor()
br i1 %cond, label %B, label %C
B:
%b = call token @llvm.experimental.convergence.anchor()
br i1 %cond, label %C, label %D
C:
%h4 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %a) ]
br i1 %cond, label %B, label %E
D:
call void @f() [ "convergencectrl"(token %b) ]
br i1 %cond, label %B, label %F
E:
call void @f() [ "convergencectrl"(token %h4) ]
br i1 %cond, label %C, label %F
F:
call void @f() [ "convergencectrl"(token %a) ]
ret void
}
; Mirror image of @irreducible1
; CHECK: Cycle heart must dominate all blocks in the cycle.
; CHECK: %h5 = call token
; CHECK: label %B
define void @irreducible2(i1 %cond) {
A:
%a = call token @llvm.experimental.convergence.anchor()
br i1 %cond, label %B, label %C
B:
%h5 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %a) ]
br i1 %cond, label %C, label %D
C:
%c = call token @llvm.experimental.convergence.anchor()
br i1 %cond, label %B, label %E
D:
call void @f() [ "convergencectrl"(token %h5) ]
br i1 %cond, label %B, label %F
E:
call void @f() [ "convergencectrl"(token %c) ]
br i1 %cond, label %C, label %F
F:
call void @f() [ "convergencectrl"(token %a) ]
ret void
}
declare token @produce_token()
declare void @f() convergent
declare void @g()
declare token @llvm.experimental.convergence.entry()
declare token @llvm.experimental.convergence.anchor()
declare token @llvm.experimental.convergence.loop()
|