[llvm] [AMDGPU] Handle amdgpu.last.use metadata (PR #83816)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 5 02:05:42 PST 2024


================
@@ -2471,12 +2491,19 @@ bool SIMemoryLegalizer::expandLoad(const SIMemOpInfo &MOI,
     return Changed;
   }
 
+  // enableVolatileAndOrNonTemporal can insert instructions and advance iterator
+  // MI and we need original instruction for enabling last use.
+  MachineInstr &Inst = *MI;
+
   // Atomic instructions already bypass caches to the scope specified by the
   // SyncScope operand. Only non-atomic volatile and nontemporal instructions
   // need additional treatment.
   Changed |= CC->enableVolatileAndOrNonTemporal(MI, MOI.getInstrAddrSpace(),
                                                 SIMemOp::LOAD, MOI.isVolatile(),
                                                 MOI.isNonTemporal());
+
+  Changed |= CC->enableLastUse(Inst, MOI.isLastUse());
----------------
jayfoad wrote:

Move this before enableVolatileAndOrNonTemporal since it no longer depends on scope?

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


More information about the llvm-commits mailing list