1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -mtriple=amdgcn-- -amdgpu-lower-module-lds --amdgpu-lower-module-lds-strategy=module < %s | FileCheck %s
3 ; RUN: opt -S -mtriple=amdgcn-- -passes=amdgpu-lower-module-lds --amdgpu-lower-module-lds-strategy=module < %s | FileCheck %s
5 @var = addrspace(3) global i32 undef, align 4
7 ; Regression test. Duplicate constantexpr in phi nodes shall not emit broken IR
8 define amdgpu_kernel void @func(i32 %c) {
11 ; CHECK-NEXT: switch i32 [[C:%.*]], label [[RETURN:%.*]] [
12 ; CHECK-NEXT: i32 0, label [[BB0:%.*]]
13 ; CHECK-NEXT: i32 1, label [[BB1:%.*]]
16 ; CHECK-NEXT: [[TMP0:%.*]] = addrspacecast ptr addrspace(3) @llvm.amdgcn.kernel.func.lds to ptr
17 ; CHECK-NEXT: br label [[BB2:%.*]]
19 ; CHECK-NEXT: [[TMP1:%.*]] = addrspacecast ptr addrspace(3) @llvm.amdgcn.kernel.func.lds to ptr
20 ; CHECK-NEXT: br label [[BB2]]
22 ; CHECK-NEXT: [[TMP:%.*]] = phi ptr [ [[TMP0]], [[BB0]] ], [ [[TMP1]], [[BB1]] ]
23 ; CHECK-NEXT: br label [[RETURN]]
25 ; CHECK-NEXT: ret void
28 switch i32 %c, label %return [
40 %tmp = phi ptr [ addrspacecast (ptr addrspace(3) @var to ptr), %bb0 ], [ addrspacecast (ptr addrspace(3) @var to ptr), %bb1 ]