1 ; RUN: opt %s -passes='print<uniformity>' -disable-output 2>&1 | FileCheck %s
3 target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64"
4 target triple = "nvptx64-nvidia-cuda"
6 define i32 @daorder(i32 %n) {
7 ; CHECK-LABEL: for function 'daorder'
9 %tid = call i32 @llvm.nvvm.read.ptx.sreg.tid.x()
10 %cond = icmp slt i32 %tid, 0
11 br i1 %cond, label %A, label %B ; divergent
12 ; CHECK: DIVERGENT: %cond =
13 ; CHECK: DIVERGENT: br i1 %cond,
15 %defAtA = add i32 %n, 1 ; uniform
16 ; CHECK-NOT: DIVERGENT: %defAtA =
19 %defAtB = add i32 %n, 2 ; uniform
20 ; CHECK-NOT: DIVERGENT: %defAtB =
23 %defAtC = phi i32 [ %defAtA, %A ], [ %defAtB, %B ] ; divergent
24 ; CHECK: DIVERGENT: %defAtC =
28 %i = phi i32 [0, %C], [ %i.inc, %E ] ; uniform
29 ; CHECK-NOT: DIVERGENT: %i = phi
33 %i.inc = add i32 %i, 1
34 %loopCnt = icmp slt i32 %i.inc, %n
35 ; CHECK-NOT: DIVERGENT: %loopCnt =
36 br i1 %loopCnt, label %D, label %exit
42 declare i32 @llvm.nvvm.read.ptx.sreg.tid.x()
43 declare i32 @llvm.nvvm.read.ptx.sreg.tid.y()
44 declare i32 @llvm.nvvm.read.ptx.sreg.tid.z()
45 declare i32 @llvm.nvvm.read.ptx.sreg.laneid()
47 !nvvm.annotations = !{!0}
48 !0 = !{ptr @daorder, !"kernel", i32 1}