[PATCH] D105192: [AMDGPU] Optimize VGPR LiveRange in waterfall loops
Ruiling, Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 8 07:46:11 PDT 2021
ruiling added inline comments.
================
Comment at: llvm/lib/Target/AMDGPU/SIOptimizeVGPRLiveRange.cpp:490
+ // Replace uses in Loop block
+ if (UseBlock == Loop && UseMI != PHI.getInstr())
+ O.setReg(NewReg);
----------------
nit: Can we do register replacement before inserting the phi instruction? then we don't need the check `UseMI != PHI.getInstr()`.
================
Comment at: llvm/lib/Target/AMDGPU/SIOptimizeVGPRLiveRange.cpp:494
+
+ LiveVariables::VarInfo &OldVarInfo = LV->getVarInfo(Reg);
+
----------------
ruiling wrote:
> I still think we need to update the LiveVariables::VarInfo for the `NewReg` to make sure LiveVariables analysis being updated. We just need to update the `Kills` to the last use in the waterfall loop. as the waterfall loop is pretty small, I think we can just reverse iterate to find the last use. I am not sure if there is any better way?
You also need to call `addRegisterKilled` to mark the last use/uses of NewReg as killed.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105192/new/
https://reviews.llvm.org/D105192
More information about the llvm-commits
mailing list