[PATCH] D149651: [UnreachableBlockElim] Don't remove LCSSA phi nodes

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 5 00:58:11 PDT 2023


foad added a comment.

> I guess you are observing code generation bug for AMDGPU? Is it replacing a phi like `%1:vgpr = phi %0:sgpr` with a `%1:vgpr = COPY %0:sgpr`? If that is the case, I think this does not sound like a root-fix.

Right, I was investigating codegen problems on AMDGPU, but this patch is not supposed to fix them all. The rationale for this patch is:

- simplify the pass
- revert a "fix" which is apparently not required
- do not *deliberately* remove all LCSSA phi nodes

> If we have some MachineIR like below (bb1 is a self-loop):
>
>    entry
>     |
>   [ bb1  bb2
>      \    /
>        bb3
>
> The unreachable block `bb2` will  be eliminated and the phi in `bb3` will then be further simplified the same way as in the LCSSA case you are seeing.

That is a good point. I guess this pass is still going to remove *some* LCSSA phi nodes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149651



More information about the llvm-commits mailing list