[llvm] [DirectX] Use a well-formed cbuffer in the unused cbuffer test (PR #164844)

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 23 09:50:12 PDT 2025


https://github.com/bogner created https://github.com/llvm/llvm-project/pull/164844

CBuffers still need a layout type for now. Fix the crash when looking up the cbuffer info.

>From c9ea2aefeed95970890f63a631e5461db4a8379b Mon Sep 17 00:00:00 2001
From: Justin Bogner <mail at justinbogner.com>
Date: Thu, 23 Oct 2025 09:47:34 -0700
Subject: [PATCH] [DirectX] Use a well-formed cbuffer in the unused cbuffer
 test

CBuffers still need a layout type for now. Fix the crash when looking up
the cbuffer info.
---
 llvm/test/CodeGen/DirectX/CBufferAccess/unused.ll | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/test/CodeGen/DirectX/CBufferAccess/unused.ll b/llvm/test/CodeGen/DirectX/CBufferAccess/unused.ll
index 8c0d82e43b4b1..6f1bbd050bd7c 100644
--- a/llvm/test/CodeGen/DirectX/CBufferAccess/unused.ll
+++ b/llvm/test/CodeGen/DirectX/CBufferAccess/unused.ll
@@ -2,7 +2,7 @@
 ; Check that we correctly ignore cbuffers that were nulled out by optimizations.
 
 %__cblayout_CB = type <{ float }>
- at CB.cb = local_unnamed_addr global target("dx.CBuffer", %__cblayout_CB) poison
+ at CB.cb = local_unnamed_addr global target("dx.CBuffer", target("dx.Layout", %__cblayout_CB, 4, 0)) poison
 @x = external local_unnamed_addr addrspace(2) global float, align 4
 
 ; CHECK-NOT: !hlsl.cbs =



More information about the llvm-commits mailing list