[PATCH] D95273: AMDGPU: Reduce the number of expensive calls in SIFormMemoryClause

Changpeng Fang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 22 18:17:28 PST 2021


cfang added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/SIFormMemoryClauses.cpp:340
 
-      if (!processRegUses(MI, Defs, Uses, RPT))
+      auto LiveRegs = RPT.getLiveRegs();
+      RegUse Defs, Uses;
----------------
rampitec wrote:
> LiveRegSet LiveRegs = ...
> Make sure you are actually copying it, not taking a reference.
How to clone a copy? I can not find a suitable RPT function for that purpose.


================
Comment at: llvm/lib/Target/AMDGPU/SIFormMemoryClauses.cpp:363
+      // Restore the state after processing the bundle.
+      RPT.reset(MI, &LiveRegs);
+
----------------
rampitec wrote:
> Move it down after "Ind->insertMachineInstrInMaps(*B);" and reset on B, not on MI. Technically MI's iterator is not valid for RPT purposes after bundling.
Shouldn't  we also restore  before the continue when there is just one instruction?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95273/new/

https://reviews.llvm.org/D95273



More information about the llvm-commits mailing list