Skip to content

Commit a1f30c2

Browse files
authored
[NFC] [DirectX] Update DirectX codegen test CBufferAccess/gep-ce-two-uses.ll due to changes to ReplaceConstant (#169848)
Fixes an LLVM DirectX codegen test after it broke due to #169141 The CBuffer loads and GEPs are no longer duplicated when there are two or more accesses within the same basic block. This PR removes the duplicate check for CBuffer load and GEP from the original test function `@f` and adds a new test function `@g` which places duplicate CBuffer loads into separate basic blocks.
1 parent 965c3d7 commit a1f30c2

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

llvm/test/CodeGen/DirectX/CBufferAccess/gep-ce-two-uses.ll

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,22 @@ entry:
2121
%a1 = load float, ptr addrspace(2) getelementptr inbounds nuw (i8, ptr addrspace(2) @a1, i32 16), align 4
2222
store float %a1, ptr %dst, align 32
2323

24+
%a2 = load float, ptr addrspace(2) getelementptr inbounds nuw (i8, ptr addrspace(2) @a1, i32 16), align 4
25+
store float %a2, ptr %dst, align 32
26+
27+
ret void
28+
}
29+
30+
; CHECK: define void @g
31+
define void @g(ptr %dst) {
32+
entry:
33+
; CHECK: [[PTR:%.*]] = call ptr addrspace(2) @llvm.dx.resource.getpointer.{{.*}}(target("dx.CBuffer", %__cblayout_CB) {{%.*}}, i32 0)
34+
; CHECK: getelementptr inbounds nuw i8, ptr addrspace(2) [[PTR]], i32 16
35+
%a1 = load float, ptr addrspace(2) getelementptr inbounds nuw (i8, ptr addrspace(2) @a1, i32 16), align 4
36+
store float %a1, ptr %dst, align 32
37+
br label %next
38+
39+
next:
2440
; CHECK: [[PTR:%.*]] = call ptr addrspace(2) @llvm.dx.resource.getpointer.{{.*}}(target("dx.CBuffer", %__cblayout_CB) {{%.*}}, i32 0)
2541
; CHECK: getelementptr inbounds nuw i8, ptr addrspace(2) [[PTR]], i32 16
2642
%a2 = load float, ptr addrspace(2) getelementptr inbounds nuw (i8, ptr addrspace(2) @a1, i32 16), align 4

0 commit comments

Comments
 (0)