[llvm] [NFC] [DirectX] Update DirectX codegen test `CBufferAccess/gep-ce-two-uses.ll` due to changes to ReplaceConstant (PR #169848)

Deric C. via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 27 10:19:54 PST 2025


https://github.com/Icohedron updated https://github.com/llvm/llvm-project/pull/169848

>From 712ef0054f296752ea298cfe45166099452e3495 Mon Sep 17 00:00:00 2001
From: Deric Cheung <cheung.deric at gmail.com>
Date: Thu, 27 Nov 2025 10:10:48 -0800
Subject: [PATCH 1/2] Update test to accomodate lack of gep duplication within
 same basic block

---
 .../DirectX/CBufferAccess/gep-ce-two-uses.ll      | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

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

>From 2ad8b9bc66d70b0ab823d425a4b23778b54c556c Mon Sep 17 00:00:00 2001
From: Deric Cheung <cheung.deric at gmail.com>
Date: Thu, 27 Nov 2025 10:19:40 -0800
Subject: [PATCH 2/2] Add check for define of @g

---
 llvm/test/CodeGen/DirectX/CBufferAccess/gep-ce-two-uses.ll | 1 +
 1 file changed, 1 insertion(+)

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 751f1d3ebcfa9..97896e598de90 100644
--- a/llvm/test/CodeGen/DirectX/CBufferAccess/gep-ce-two-uses.ll
+++ b/llvm/test/CodeGen/DirectX/CBufferAccess/gep-ce-two-uses.ll
@@ -27,6 +27,7 @@ entry:
   ret void
 }
 
+; CHECK: define void @g
 define void @g(ptr %dst) {
 entry:
   ; CHECK: [[PTR:%.*]] = call ptr addrspace(2) @llvm.dx.resource.getpointer.{{.*}}(target("dx.CBuffer", %__cblayout_CB) {{%.*}}, i32 0)



More information about the llvm-commits mailing list