[llvm] [AMDGPU] Poison invalid globals after emitting error in LowerBufferFatPointers pass (PR #184662)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 4 10:56:19 PST 2026


================
@@ -2467,11 +2467,13 @@ bool AMDGPULowerBufferFatPointers::run(Module &M, const TargetMachine &TM) {
 
   BufferFatPtrToStructTypeMap StructTM(DL);
   BufferFatPtrToIntTypeMap IntTM(DL);
-  for (const GlobalVariable &GV : M.globals()) {
+  SmallVector<GlobalVariable *, 4> InvalidGlobals;
+  for (GlobalVariable &GV : M.globals()) {
     if (GV.getAddressSpace() == AMDGPUAS::BUFFER_FAT_POINTER) {
       // FIXME: Use DiagnosticInfo unsupported but it requires a Function
       Ctx.emitError("global variables with a buffer fat pointer address "
                     "space (7) are not supported");
+      InvalidGlobals.push_back(&GV);
----------------
arsenm wrote:

Can't you directly replace here? Don't need the intermediate vector?

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


More information about the llvm-commits mailing list