| Justin Lebar | 96e2915 | 2016-11-29 21:49:02 +0000 | [diff] [blame] | 1 | ; RUN: opt -o /dev/null -structurizecfg %s | 
|  | 2 |  | 
|  | 3 | ; The following function caused an infinite loop inside the structurizer's | 
|  | 4 | ; rebuildSSA routine, where we were iterating over an instruction's uses while | 
|  | 5 | ; modifying the use list, without taking care to do this safely. | 
|  | 6 |  | 
|  | 7 | target triple = "amdgcn--" | 
|  | 8 |  | 
|  | 9 | declare <4 x float> @llvm.SI.vs.load.input(<16 x i8>, i32, i32) #0 | 
|  | 10 | declare <4 x float> @llvm.amdgcn.image.load.v4f32.v2i32.v8i32(<2 x i32>, <8 x i32>, i32, i1, i1, i1, i1) #1 | 
|  | 11 | declare void @llvm.SI.export(i32, i32, i32, i32, i32, float, float, float, float) #2 | 
|  | 12 |  | 
|  | 13 | define amdgpu_vs void @wrapper(i32 inreg, i32) { | 
|  | 14 | main_body: | 
|  | 15 | %2 = add i32 %1, %0 | 
|  | 16 | %3 = call <4 x float> @llvm.SI.vs.load.input(<16 x i8> undef, i32 0, i32 %2) | 
|  | 17 | %4 = extractelement <4 x float> %3, i32 1 | 
|  | 18 | %5 = fptosi float %4 to i32 | 
|  | 19 | %6 = insertelement <2 x i32> undef, i32 %5, i32 1 | 
|  | 20 | br label %loop11.i | 
|  | 21 |  | 
|  | 22 | loop11.i:                                         ; preds = %endif46.i, %main_body | 
|  | 23 | %7 = phi i32 [ 0, %main_body ], [ %15, %endif46.i ] | 
|  | 24 | %8 = icmp sgt i32 %7, 999 | 
|  | 25 | br i1 %8, label %main.exit, label %if16.i | 
|  | 26 |  | 
|  | 27 | if16.i:                                           ; preds = %loop11.i | 
|  | 28 | %9 = call <4 x float> @llvm.amdgcn.image.load.v4f32.v2i32.v8i32(<2 x i32> %6, <8 x i32> undef, i32 15, i1 true, i1 false, i1 false, i1 false) | 
|  | 29 | %10 = extractelement <4 x float> %9, i32 0 | 
|  | 30 | %11 = fcmp ult float 0.000000e+00, %10 | 
|  | 31 | br i1 %11, label %if28.i, label %endif46.i | 
|  | 32 |  | 
|  | 33 | if28.i:                                           ; preds = %if16.i | 
|  | 34 | %12 = bitcast float %10 to i32 | 
|  | 35 | %13 = shl i32 %12, 16 | 
|  | 36 | %14 = bitcast i32 %13 to float | 
|  | 37 | br label %main.exit | 
|  | 38 |  | 
|  | 39 | endif46.i:                                        ; preds = %if16.i | 
|  | 40 | %15 = add i32 %7, 1 | 
|  | 41 | br label %loop11.i | 
|  | 42 |  | 
|  | 43 | main.exit:                                        ; preds = %if28.i, %loop11.i | 
|  | 44 | %16 = phi float [ %14, %if28.i ], [ 0x36F0800000000000, %loop11.i ] | 
|  | 45 | call void @llvm.SI.export(i32 15, i32 0, i32 0, i32 32, i32 0, float %16, float 0.000000e+00, float 0.000000e+00, float 0x36A0000000000000) | 
|  | 46 | ret void | 
|  | 47 | } | 
|  | 48 |  | 
|  | 49 | attributes #0 = { nounwind readnone } | 
|  | 50 | attributes #1 = { nounwind readonly } | 
|  | 51 | attributes #2 = { nounwind } |