brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 971a6a1 Raw
76 lines · plain
1; RUN: opt -mtriple amdgcn-- -passes='print<uniformity>' -disable-output %s 2>&1 | FileCheck %s2;3; This is to test an if-then-else case with some unmerged basic blocks4; (https://github.com/llvm/llvm-project/issues/137277)5;6;      Entry (div.cond)7;      /   \8;     B0   B39;     |    |10;     B1   B411;     |    |12;     B2   B513;      \  /14;       B6 (phi: divergent)15;16 17 18; CHECK-LABEL:  'test_ctrl_divergence':19; CHECK-LABEL:  BLOCK Entry20; CHECK:  DIVERGENT:   %div.cond = icmp eq i32 %tid, 021; CHECK:  DIVERGENT:   br i1 %div.cond, label %B3, label %B022;23; CHECK-LABEL:  BLOCK B624; CHECK:  DIVERGENT:   %div_a = phi i32 [ %a0, %B2 ], [ %a1, %B5 ]25; CHECK:  DIVERGENT:   %div_b = phi i32 [ %b0, %B2 ], [ %b1, %B5 ]26; CHECK:  DIVERGENT:   %div_c = phi i32 [ %c0, %B2 ], [ %c1, %B5 ]27 28 29define amdgpu_kernel void @test_ctrl_divergence(i32 %a, i32 %b, i32 %c, i32 %d) {30Entry:31  %tid = call i32 @llvm.amdgcn.workitem.id.x()32  %div.cond = icmp eq i32 %tid, 033  br i1 %div.cond, label %B3, label %B0 ; divergent branch34 35B0:36  %a0 = add i32 %a, 137  br label %B138 39B1:40  %b0 = add i32 %b, 241  br label %B242 43B2:44  %c0 = add i32 %c, 345  br label %B646 47B3:48  %a1 = add i32 %a, 1049  br label %B450 51B4:52  %b1 = add i32 %b, 2053  br label %B554 55B5:56  %c1 = add i32 %c, 3057  br label %B658 59B6:60  %div_a = phi i32 [%a0, %B2], [%a1,  %B5]61  %div_b = phi i32 [%b0, %B2], [%b1,  %B5]62  %div_c = phi i32 [%c0, %B2], [%c1,  %B5]63  br i1 %div.cond, label %B8, label %B7 ; divergent branch64 65B7:66  %d1 = add i32 %d, 167  br label %B868 69B8:70  %div_d = phi i32 [%d1, %B7], [%d, %B6]71  ret void72}73 74 75declare i32 @llvm.amdgcn.workitem.id.x()76