Changpeng Fang | 26fb9d2 | 2016-07-28 23:01:45 +0000 | [diff] [blame] | 1 | ; RUN: opt -mtriple=amdgcn-- -S -structurizecfg -si-annotate-control-flow %s | FileCheck -check-prefix=OPT %s |
| 2 | ; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s |
| 3 | |
| 4 | |
| 5 | ; OPT-LABEL: @annotate_unreachable_noloop( |
| 6 | ; OPT-NOT: call i1 @llvm.amdgcn.loop |
| 7 | |
| 8 | ; GCN-LABEL: {{^}}annotate_unreachable_noloop: |
| 9 | ; GCN: s_cbranch_vccnz |
| 10 | ; GCN-NOT: s_endpgm |
| 11 | ; GCN: .Lfunc_end0 |
| 12 | define void @annotate_unreachable_noloop(<4 x float> addrspace(1)* noalias nocapture readonly %arg) #0 { |
| 13 | bb: |
| 14 | %tmp = tail call i32 @llvm.amdgcn.workitem.id.x() |
| 15 | br label %bb1 |
| 16 | |
| 17 | bb1: ; preds = %bb |
| 18 | %tmp2 = sext i32 %tmp to i64 |
| 19 | %tmp3 = getelementptr inbounds <4 x float>, <4 x float> addrspace(1)* %arg, i64 %tmp2 |
| 20 | %tmp4 = load <4 x float>, <4 x float> addrspace(1)* %tmp3, align 16 |
| 21 | br i1 undef, label %bb5, label %bb3 |
| 22 | |
| 23 | bb3: ; preds = %bb1 |
| 24 | %tmp6 = extractelement <4 x float> %tmp4, i32 2 |
| 25 | %tmp7 = fcmp olt float %tmp6, 0.000000e+00 |
| 26 | br i1 %tmp7, label %bb4, label %bb5 ; crash goes away if these are swapped |
| 27 | |
| 28 | bb4: ; preds = %bb3 |
| 29 | unreachable |
| 30 | |
| 31 | bb5: ; preds = %bb3, %bb1 |
| 32 | unreachable |
| 33 | } |
| 34 | |
| 35 | |
| 36 | ; OPT-LABEL: @annotate_ret_noloop( |
| 37 | ; OPT-NOT: call i1 @llvm.amdgcn.loop |
| 38 | |
| 39 | ; GCN-LABEL: {{^}}annotate_ret_noloop: |
Kyle Butt | efe56fe | 2017-01-11 19:55:19 +0000 | [diff] [blame] | 40 | ; GCN: s_cbranch_scc1 |
Changpeng Fang | 26fb9d2 | 2016-07-28 23:01:45 +0000 | [diff] [blame] | 41 | ; GCN: s_endpgm |
| 42 | ; GCN: .Lfunc_end1 |
| 43 | define void @annotate_ret_noloop(<4 x float> addrspace(1)* noalias nocapture readonly %arg) #0 { |
| 44 | bb: |
| 45 | %tmp = tail call i32 @llvm.amdgcn.workitem.id.x() |
| 46 | br label %bb1 |
| 47 | |
| 48 | bb1: ; preds = %bb |
| 49 | %tmp2 = sext i32 %tmp to i64 |
| 50 | %tmp3 = getelementptr inbounds <4 x float>, <4 x float> addrspace(1)* %arg, i64 %tmp2 |
| 51 | %tmp4 = load <4 x float>, <4 x float> addrspace(1)* %tmp3, align 16 |
| 52 | br i1 undef, label %bb5, label %bb3 |
| 53 | |
| 54 | bb3: ; preds = %bb1 |
| 55 | %tmp6 = extractelement <4 x float> %tmp4, i32 2 |
| 56 | %tmp7 = fcmp olt float %tmp6, 0.000000e+00 |
| 57 | br i1 %tmp7, label %bb4, label %bb5 ; crash goes away if these are swapped |
| 58 | |
| 59 | bb4: ; preds = %bb3 |
| 60 | ret void |
| 61 | |
| 62 | bb5: ; preds = %bb3, %bb1 |
| 63 | ret void |
| 64 | } |
| 65 | |
| 66 | |
| 67 | declare i32 @llvm.amdgcn.workitem.id.x() #1 |
| 68 | |
| 69 | attributes #0 = { nounwind } |
| 70 | attributes #1 = { nounwind readnone } |