[llvm] [NFC] [DirectX] Update DirectX codegen test `CBufferAccess/gep-ce-two-uses.ll` due to changes to ReplaceConstant (PR #169848)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 27 10:18:40 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-directx
Author: Deric C. (Icohedron)
<details>
<summary>Changes</summary>
Fixes an LLVM DirectX codegen test after it broke due to #<!-- -->169141
The CBuffer loads and GEPs are no longer duplicated when in there are two or more accesses within the same basic block.
This PR removes the duplicate 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.
---
Full diff: https://github.com/llvm/llvm-project/pull/169848.diff
1 Files Affected:
- (modified) llvm/test/CodeGen/DirectX/CBufferAccess/gep-ce-two-uses.ll (+15)
``````````diff
diff --git a/llvm/test/CodeGen/DirectX/CBufferAccess/gep-ce-two-uses.ll b/llvm/test/CodeGen/DirectX/CBufferAccess/gep-ce-two-uses.ll
index 4eda6353f47ed..751f1d3ebcfa9 100644
--- a/llvm/test/CodeGen/DirectX/CBufferAccess/gep-ce-two-uses.ll
+++ b/llvm/test/CodeGen/DirectX/CBufferAccess/gep-ce-two-uses.ll
@@ -21,6 +21,21 @@ entry:
%a1 = load float, ptr addrspace(2) getelementptr inbounds nuw (i8, ptr addrspace(2) @a1, i32 16), align 4
store float %a1, ptr %dst, align 32
+ %a2 = load float, ptr addrspace(2) getelementptr inbounds nuw (i8, ptr addrspace(2) @a1, i32 16), align 4
+ store float %a2, ptr %dst, align 32
+
+ ret void
+}
+
+define void @g(ptr %dst) {
+entry:
+ ; CHECK: [[PTR:%.*]] = call ptr addrspace(2) @llvm.dx.resource.getpointer.{{.*}}(target("dx.CBuffer", %__cblayout_CB) {{%.*}}, i32 0)
+ ; CHECK: getelementptr inbounds nuw i8, ptr addrspace(2) [[PTR]], i32 16
+ %a1 = load float, ptr addrspace(2) getelementptr inbounds nuw (i8, ptr addrspace(2) @a1, i32 16), align 4
+ store float %a1, ptr %dst, align 32
+ br label %next
+
+next:
; CHECK: [[PTR:%.*]] = call ptr addrspace(2) @llvm.dx.resource.getpointer.{{.*}}(target("dx.CBuffer", %__cblayout_CB) {{%.*}}, i32 0)
; CHECK: getelementptr inbounds nuw i8, ptr addrspace(2) [[PTR]], i32 16
%a2 = load float, ptr addrspace(2) getelementptr inbounds nuw (i8, ptr addrspace(2) @a1, i32 16), align 4
``````````
</details>
https://github.com/llvm/llvm-project/pull/169848
More information about the llvm-commits
mailing list