[clang] [NFC][HLSL] Remove useless GEP (PR #177584)
Nathan Gauër via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 23 05:35:28 PST 2026
https://github.com/Keenuts created https://github.com/llvm/llvm-project/pull/177584
This code was adding a GEP which was constant folded anyway. Removed it.
>From e459db5b6ab4a7d0cc39f734343b15bcf5bf5775 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= <brioche at google.com>
Date: Fri, 23 Jan 2026 14:34:05 +0100
Subject: [PATCH] [NFC][HLSL] Remove useless GEP
This code was adding a GEP which was constant folded anyway.
Removed it.
---
clang/lib/CodeGen/CGHLSLRuntime.cpp | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp b/clang/lib/CodeGen/CGHLSLRuntime.cpp
index e796bbb5855c8..cff2824d29dc5 100644
--- a/clang/lib/CodeGen/CGHLSLRuntime.cpp
+++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp
@@ -1113,9 +1113,7 @@ static void initializeBuffer(CodeGenModule &CGM, llvm::GlobalVariable *GV,
/*ReturnType=*/HandleTy, IntrID, Args, nullptr,
Twine(GV->getName()).concat("_h"));
- llvm::Value *HandleRef = Builder.CreateStructGEP(GV->getValueType(), GV, 0);
- Builder.CreateAlignedStore(CreateHandle, HandleRef,
- HandleRef->getPointerAlignment(DL));
+ Builder.CreateAlignedStore(CreateHandle, GV, GV->getPointerAlignment(DL));
Builder.CreateRetVoid();
CGM.AddCXXGlobalInit(InitResFunc);
More information about the cfe-commits
mailing list