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

Ruiling, Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 9 20:07:11 PST 2022


ruiling accepted this revision.
ruiling added a comment.
This revision is now accepted and ready to land.

LGTM



================
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:
> > 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.
> > 
> The lowered SI_END_CF is not inserted at its original position in the block. It is moved to the top of the block, moving it before the phis which were lowered
I missed the trick we have already reordered the instructions during phi elimination. The only COPY comes before SI_END_CF is the one that generate source of SI_END_CF.


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

https://reviews.llvm.org/D117796



More information about the llvm-commits mailing list