[llvm] [DirectX] Reland #142853 with Circular GEP fixes (PR #143747)

Farzon Lotfi via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 11 09:53:13 PDT 2025


================
@@ -271,10 +275,18 @@ bool DXILFlattenArraysVisitor::visitGetElementPtrInstInGEPChainBase(
         genInstructionFlattenIndices(GEPInfo.Indices, GEPInfo.Dims, Builder);
 
   ArrayType *FlattenedArrayType = GEPInfo.ParentArrayType;
+  
+  // Don't append '.flat' to an empty string. If the SSA name isn't available
+  // it could conflict with the ParentOperand's name.
+  std::string FlatName = GEP.hasName() ? GEP.getName().str() + ".flat" : "";
----------------
farzonl wrote:

did `.str()` in this case because clangd warned that `getName()` alone could cause a potential use after free.

https://github.com/llvm/llvm-project/pull/143747


More information about the llvm-commits mailing list