1 ; RUN: opt -S -passes=jump-threading,verify < %s | FileCheck %s
3 target datalayout = "e-i64:64-i128:128-v16:16-v32:32-n16:32:64"
4 target triple = "nvptx64-nvidia-cuda"
6 $wrapped_tid = comdat any
10 define i32 @wrapped_tid() #0 comdat align 32 {
15 declare void @llvm.nvvm.barrier0() #1
17 ; We had a bug where we duplicated basic blocks containing convergent
18 ; functions like @llvm.nvvm.barrier0 below. Verify that we don't do
20 define void @foo() local_unnamed_addr #2 comdat align 32 {
27 %4 = icmp eq i32 %1, 0
28 br i1 %4, label %5, label %6
35 ; CHECK: call void @llvm.nvvm.barrier0()
36 ; CHECK-NOT: call void @llvm.nvvm.barrier0()
37 call void @llvm.nvvm.barrier0()
38 %7 = icmp eq i32 %2, 0
39 br i1 %7, label %11, label %8
42 %9 = icmp ult i32 %1, 49
43 br i1 %9, label %10, label %11
46 call void @llvm.trap()
57 declare void @llvm.trap() #3
59 attributes #1 = { convergent }
60 attributes #2 = { readnone }
61 attributes #3 = { noreturn }
62 attributes #4 = { convergent }