thread-two-bbs-cuda.ll
1.19 KB
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
; RUN: opt < %s -jump-threading -S -verify | FileCheck %s
target datalayout = "e-i64:64-i128:128-v16:16-v32:32-n16:32:64"
target triple = "nvptx64-nvidia-cuda"
$wrapped_tid = comdat any
$foo = comdat any
define i32 @wrapped_tid() #0 comdat align 32 {
%1 = call i32 @tid()
ret i32 %1
}
declare void @llvm.nvvm.barrier0() #1
; We had a bug where we duplicated basic blocks containing convergent
; functions like @llvm.nvvm.barrier0 below. Verify that we don't do
; that.
define void @foo() local_unnamed_addr #2 comdat align 32 {
; CHECK-LABEL: @foo
%1 = call i32 @tid()
%2 = urem i32 %1, 7
br label %3
3:
%4 = icmp eq i32 %1, 0
br i1 %4, label %5, label %6
5:
call void @bar()
br label %6
6:
; CHECK: call void @llvm.nvvm.barrier0()
; CHECK-NOT: call void @llvm.nvvm.barrier0()
call void @llvm.nvvm.barrier0()
%7 = icmp eq i32 %2, 0
br i1 %7, label %11, label %8
8:
%9 = icmp ult i32 %1, 49
br i1 %9, label %10, label %11
10:
call void @llvm.trap()
unreachable
11:
br label %3
}
declare i32 @tid() #2
declare void @bar()
declare void @llvm.trap() #3
attributes #1 = { convergent }
attributes #2 = { readnone }
attributes #3 = { noreturn }
attributes #4 = { convergent }