1 ; RUN: llc < %s -march=nvptx64 -mcpu=sm_35 -disable-cgp | FileCheck %s 2 ; Disable CGP which also folds branches, so that only BranchFolding is under 3 ; the spotlight. 4 5 target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64" 6 target triple = "nvptx64-nvidia-cuda" 7 8 define void @foo(i32 %x, float* %output) { 9 ; CHECK-LABEL: .visible .func foo( 10 ; CHECK-NOT: bra.uni 11 ; CHECK-NOT: LBB0_ 12 %1 = icmp eq i32 %x, 1 13 br i1 %1, label %then, label %else 14 15 then: 16 br label %merge 17 18 else: 19 br label %merge 20 21 merge: 22 store float 2.0, float* %output 23 ret void 24 } 25 26 ; PR24299. no crash 27 define ptx_kernel void @hoge() #0 { 28 ; CHECK-LABEL: .visible .entry hoge( 29 bb: 30 br i1 undef, label %bb1, label %bb4 31 32 bb1: ; preds = %bb1, %bb 33 %tmp = phi i64 [ %tmp2, %bb1 ], [ undef, %bb ] 34 %tmp2 = add nsw i64 %tmp, 1 35 %tmp3 = icmp sle i64 %tmp, 0 36 br i1 %tmp3, label %bb1, label %bb4 37 38 bb4: ; preds = %bb4, %bb1, %bb 39 br label %bb4 40 } 41