[PATCH] D80434: [AMDGPU] Reject moving PHI to VALU if the only VGPR input originated from move immediate

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 22 14:30:21 PDT 2020


rampitec added a comment.

In D80434#2051603 <https://reviews.llvm.org/D80434#2051603>, @alex-t wrote:

> In D80434#2051602 <https://reviews.llvm.org/D80434#2051602>, @rampitec wrote:
>
> > You do not even need a loop to get PHI. A PHI might occur after an simple IF.
> >  Nevertheless, patch retains an illegal copy which it is supposed to remove. The fact that it works in this testcase does not mean it will always work.
> >  I would suggest to fold the immediate copy instead. I.e. you can replace COPY with an S_MOV_B32 (given it fits 32 bit of course).
>
>
> The following code does it in one of the next iterations
>
>   // If we are just copying an immediate, we can replace the copy with
>   // s_mov_b32.
>   if (isSafeToFoldImmIntoCopy(&MI, DefMI, TII, SMovOp, Imm)) {
>     MI.getOperand(1).ChangeToImmediate(Imm);
>     MI.addImplicitDefUseOperands(MF);
>     MI.setDesc(TII->get(SMovOp));
>     break;
>   }
>   
>   


What if not isSafeToFoldImmIntoCopy?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80434





More information about the llvm-commits mailing list