[PATCH] D64354: [AArch64][GlobalISel] Optimize conditional branches followed by unconditional branches

Amara Emerson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 8 11:15:12 PDT 2019


aemerson marked 2 inline comments as done.
aemerson added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp:1186
+    return false;
+  assert(std::next(BrIt) == MBB->end() &&
+         "expected G_BR to be a terminator");
----------------
paquette wrote:
> Would ` BrIt->isTerminator()` work here?
Branch is a terminator by nature, so it doesn't check the same thing, although the usefulness of this assert is debatable.


================
Comment at: llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp:1197
+
+  // Look through the trunc to get the icmp.
+  MachineInstr *TruncMI = MRI.getVRegDef(BrCond->getOperand(0).getReg());
----------------
paquette wrote:
> Is trunc the only thing we should look through here? Can we also handle copies, for example?
For arm64 it seems to be the only thing in between compares and branches in practice due to our legalization rules. This code will be removed anyway since I'm going to put this before the legalizer so we shouldn't see any artifacts in between the ops,


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64354





More information about the llvm-commits mailing list