[PATCH] D117796: AMDGPU: Fix LiveVariables error after lowering SI_END_CF

Ruiling, Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 7 19:25:38 PST 2022


ruiling added a comment.

> The reason we are splitting the block is so we can place the exec modification before the copies for lowered phis. We cannot split the block as needed while the phis still exist since phis need to be the first instructions in the block

I don't understand, we are moving out instructions after SI_END_CF into a new block, all the PHIs and SI_END_CF will still be in the old block. Why are we breaking the phis?
To make it clear, I am not strongly asking for this now. I am fine with fixing the LiveVariable update issue.



================
Comment at: llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp:531
+        if (VI.AliveBlocks.test(MBB.getNumber()))
+          VI.AliveBlocks.set(SplitBB->getNumber());
+        else {
----------------
arsenm wrote:
> ruiling wrote:
> > Is it possible that a value defined in MBB (and kept in MBB after split) and killed in successor block, now becomes alive in SplitBB?
> That's covered by updating the Killed set, replaceKillInstruction
It is something like below after split:
```
MBB:
  %a = PHI ... // this will be lowered into COPY after phi-elim
 ...
SplitBB:
  ...
Succ:
  use(%a)
```

%a is not the source of SI_END_CF, here we need to insert SplitBB into AliveBlocks of %a.



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

https://reviews.llvm.org/D117796



More information about the llvm-commits mailing list