[all-commits] [llvm/llvm-project] 507d19: [AArch64][GlobalISel] Handle multiple phis in fixu...

Jessica Paquette via All-commits all-commits at lists.llvm.org
Fri Jun 4 10:00:16 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 507d193ea7ef20ec77615b55836b4653f736cef3
      https://github.com/llvm/llvm-project/commit/507d193ea7ef20ec77615b55836b4653f736cef3
  Author: Jessica Paquette <jpaquette at apple.com>
  Date:   2021-06-04 (Fri, 04 Jun 2021)

  Changed paths:
    M llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
    M llvm/test/CodeGen/AArch64/GlobalISel/preselect-process-phis.mir

  Log Message:
  -----------
  [AArch64][GlobalISel] Handle multiple phis in fixupPHIOpBanks

If we ended up with two phi instructions in a block, and we needed to fix up
the banks for the first one, we'd end up inserting our COPY before the second
phi.

E.g.

```
%x = G_PHI ...
%fixup = COPY ...
%y = G_PHI ...
```

This is invalid MIR, and breaks assumptions made by the register allocator later
down the line. With the verifier enabled, it also emits a verification error.

This teaches fixupPHIOpBanks to walk past any phi instructions in the block
when emitting the fixup copies.

Here's an example of the crashing code (same as added testcase):
https://godbolt.org/z/h5j1x3o6e

Differential Revision: https://reviews.llvm.org/D103582




More information about the All-commits mailing list