[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:22:43 PDT 2021
ruiling added inline comments.
================
Comment at: llvm/lib/Target/AMDGPU/SIOptimizeVGPRLiveRange.cpp:494
+
+ LiveVariables::VarInfo &OldVarInfo = LV->getVarInfo(Reg);
+
----------------
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?
================
Comment at: llvm/lib/Target/AMDGPU/SIOptimizeVGPRLiveRange.cpp:498-504
+ bool IsUsed = false;
+ for (auto *Succ : Loop->successors()) {
+ if (Succ != Loop && OldVarInfo.isLiveIn(*Succ, Reg, *MRI)) {
+ IsUsed = true;
+ break;
+ }
+ }
----------------
I would like such check happens in `collectWaterfallCandidateRegisters()` which means if it is used after waterfall loop, don't push into candidate list. Because for such kind of situations, the optimization transformation we do here does not help as it will be coalesced into one virtual register again in register coalescer. So IMO, this is just waste of compile time for no benefit.
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