[clang] [llvm] [clang][SPIR-V] Implement -fspv-preserve-interface (PR #196404)

Juan Manuel Martinez CaamaƱo via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 4 08:43:30 PDT 2026


================
@@ -2507,7 +2542,7 @@ void SPIRVEmitIntrinsics::processGlobalValue(GlobalVariable &GV,
                                        {GV.getType(), Ty}, {&GV, Const});
     InitInst->setArgOperand(1, InitOp);
   }
-  if (!Init && GV.use_empty())
+  if (!Init && (GV.use_empty() || hasOnlyArtificialUses(GV)))
----------------
jmmartinez wrote:

MC: `GV.use_empty()` implies `hasOnlyArtificialUses(GV)`; so it is redundant.

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


More information about the cfe-commits mailing list