[PATCH] D106291: [AMDGPU] Improve killed check for vgpr optimization

Ruiling, Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 19 17:23:36 PDT 2021


ruiling added a comment.

In D106291#2888251 <https://reviews.llvm.org/D106291#2888251>, @arsenm wrote:

> Kill flags are deprecated and we should try to avoid using them.

Is there any previous discussion about this? what's the motivation for this?

> Register liveness should start at the bottom of the block and scan backwards for defs

After some further thinking, I agree the kill flag is not much useful. Even without kill flag, we can still easily find the kill instruction through the `Kills` in `VarInfo` with LiveVariables information if we need it.
Luckily we do not need that anymore after removing this only occurrence of checking kill flag.



================
Comment at: llvm/lib/Target/AMDGPU/SIOptimizeVGPRLiveRange.cpp:246
+              // branches.
+              LiveVariables::VarInfo &VI = LV->getVarInfo(MOReg);
+              if (VI.isLiveIn(*Endif, MOReg, *MRI)) {
----------------
arsenm wrote:
> Shouldn't this give the same result even if it is killed? Do you really need to check it?
I think Matt is correct. we just need to check the register is not live into the EndIf Block, then we can say it is killed in the Else region. The reason it works is because we only care the value is killed in the Else region, we don't care the specific instruction that kills the value. Please also update the commit message.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106291



More information about the llvm-commits mailing list