llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-codegen

Author: Nathan Gauër (Keenuts)

<details>
<summary>Changes</summary>

This code was adding a GEP which was constant folded anyway. Removed it.

---
Full diff: https://github.com/llvm/llvm-project/pull/177584.diff


1 Files Affected:

- (modified) clang/lib/CodeGen/CGHLSLRuntime.cpp (+1-3) 


``````````diff
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);

``````````

</details>


https://github.com/llvm/llvm-project/pull/177584
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to