[PATCH] D103582: [AArch64][GlobalISel] Handle multiple phis in fixupPHIOpBanks

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 3 14:31:43 PDT 2021


paquette added inline comments.


================
Comment at: llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp:6012
+      if (InsertPt != OpDefBB.end() && InsertPt->isPHI())
+        InsertPt = OpDefBB.getFirstNonPHI();
+      MIB.setInsertPt(*OpDef->getParent(), InsertPt);
----------------
aemerson wrote:
> Can we simply use getFirstNonPHI() unconditionally?
No, because the point where we're inserting the COPY may be in a block without phis.

e.g. in `test_loop_phi_gpr_to_fpr`:

```
  bb.1:
    successors: %bb.2(0x80000000)

    %6:gpr(s32) = G_IMPLICIT_DEF
    %7:gpr(s32) = G_SELECT %0(s1), %6, %6
    %1:gpr(s16) = G_TRUNC %7(s32)

  bb.2:
```

In this case, `OpDef` is the `G_TRUNC`. So, we need to insert the copy after it (at the end of the block). So, inserting after the first non-phi instruction isn't correct here.


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

https://reviews.llvm.org/D103582



More information about the llvm-commits mailing list