[llvm] 9ad4102 - [SPIRV] Simplify by not using StructType::setBody unnecessarily (#212736)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 02:36:03 PDT 2026


Author: Jay Foad
Date: 2026-08-20T10:35:58+01:00
New Revision: 9ad41024118f98ebe1796a45a48c639558c94fa5

URL: https://github.com/llvm/llvm-project/commit/9ad41024118f98ebe1796a45a48c639558c94fa5
DIFF: https://github.com/llvm/llvm-project/commit/9ad41024118f98ebe1796a45a48c639558c94fa5.diff

LOG: [SPIRV] Simplify by not using StructType::setBody unnecessarily (#212736)

Added: 
    

Modified: 
    llvm/lib/Target/SPIRV/SPIRVUtils.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/SPIRV/SPIRVUtils.cpp b/llvm/lib/Target/SPIRV/SPIRVUtils.cpp
index 75fb210a19244..b10c06ca9b484 100644
--- a/llvm/lib/Target/SPIRV/SPIRVUtils.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVUtils.cpp
@@ -1247,13 +1247,12 @@ Type *reconstitutePeeledArrayType(Type *Ty) {
     return Ty;
 
   Type *ResultTy;
-  if (STy->isLiteral())
+  if (STy->isLiteral()) {
     ResultTy =
         StructType::get(STy->getContext(), NewElementTypes, STy->isPacked());
-  else {
-    auto *NewTy = StructType::create(STy->getContext(), STy->getName());
-    NewTy->setBody(NewElementTypes, STy->isPacked());
-    ResultTy = NewTy;
+  } else {
+    ResultTy = StructType::create(STy->getContext(), NewElementTypes,
+                                  STy->getName(), STy->isPacked());
   }
   return ResultTy;
 }


        


More information about the llvm-commits mailing list