[PATCH] D107160: [AArch64] Do not emit an extra zero-extend for i1 argument

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 30 16:36:15 PDT 2021


paquette added a comment.

If it's possible to handle this using AssertZExt on the SDAG side, I think it would be nice to handle it similarly on the GISel side using G_ASSERT_ZEXT.



================
Comment at: llvm/lib/Target/AArch64/GISel/AArch64CallLowering.cpp:1053
+
+  MachineInstr *ArgDef = MRI.getVRegDef(AI.Regs[0]);
+  if (!ArgDef || ArgDef->getOpcode() != TargetOpcode::G_TRUNC)
----------------
I think that you can handle most of the logic in here using MIPatternMatch:

```
Register OrigReg;
if (!mi_match(AI.Regs[0], MRI, m_GTrunc(m_Reg(OrigReg))))
   return false;
```


================
Comment at: llvm/lib/Target/AArch64/GISel/AArch64CallLowering.cpp:1062
+  Register OrigReg = Op.getReg();
+  for (const Register &BoolReg : FuncInfo.getBoolRegParms()) {
+    if (BoolReg == OrigReg) {
----------------
Maybe this loop can be replaced with `llvm::any_of`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107160



More information about the llvm-commits mailing list