[PATCH] D107160: [AArch64] Do not emit an extra zero-extend for i1 argument
Andrew Savonichev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 8 07:51:49 PDT 2021
asavonic added inline comments.
================
Comment at: llvm/lib/Target/AArch64/GISel/AArch64CallLowering.cpp:553
+ Register OrigReg = OrigArg.Regs[0];
+ Register WideReg = MRI.createGenericVirtualRegister(LLT(MVT::i8));
+ OrigArg.Regs[0] = WideReg;
----------------
aemerson wrote:
> This can be `LLT::scalar(8)`
Done.
================
Comment at: llvm/lib/Target/AArch64/GISel/AArch64CallLowering.cpp:587
+ MIRBuilder
+ .buildAssertZExt(WideTy, WideReg, OrigTy.getScalarSizeInBits())
+ .getReg(0);
----------------
aemerson wrote:
> If these are bool args then we can assume OrigTy.getScalarSizeInBits() == 1 right?
Right. Added an assert and replaced the call with 1.
================
Comment at: llvm/lib/Target/AArch64/GISel/AArch64CallLowering.cpp:588-589
+ .buildAssertZExt(WideTy, WideReg, OrigTy.getScalarSizeInBits())
+ .getReg(0);
+ MIRBuilder.buildTrunc(OrigReg, WideReg);
+ }
----------------
aemerson wrote:
> MIRBuilder's builder methods return a MachineInstrBuilder that can be directly passed into most source operands of other builder methods. You can simplify these lines into something like:
> ```
> MIRBuilder.buildTrunc(OrigReg, MIRBuilder.buildAssertZExt(WideTy, WideReg, 1));
> ```
>
Thank you. Done.
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