[PATCH] D92358: [AArch64][GlobalISel] Select Bcc when it's better than TB(N)Z
Amara Emerson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 1 00:25:24 PST 2020
aemerson added inline comments.
================
Comment at: llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp:1427-1428
+ MachineRegisterInfo &MRI = *MIB.getMRI();
+ assert(!MRI.getType(CompareReg).isVector() && "Expected scalar only?");
+ unsigned Width = MRI.getType(CompareReg).getSizeInBits();
+ assert(Width <= 64 && "Expected width to be at most 64?");
----------------
We can cache the getType().
================
Comment at: llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp:1508
- if (!VRegAndVal || VRegAndVal->Value != 0) {
- // If we can't select a CBZ then emit a cmp + Bcc.
- auto Pred =
- static_cast<CmpInst::Predicate>(CCMI->getOperand(1).getPredicate());
- emitIntegerCompare(CCMI->getOperand(2), CCMI->getOperand(3),
- CCMI->getOperand(1), MIB);
- const AArch64CC::CondCode CC = changeICMPPredToAArch64CC(Pred);
- MIB.buildInstr(AArch64::Bcc, {}, {}).addImm(CC).addMBB(DestMBB);
- I.eraseFromParent();
- return true;
- }
+ if (VRegAndVal && VRegAndVal->Value == 0 && IsEquality) {
+ if (tryOptAndIntoCompareBranch(LHSMI, VRegAndVal->Value, Pred, DestMBB,
----------------
Seems we lost the comment for this case.
================
Comment at: llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp:1516
+ auto LHSTy = MRI.getType(LHS);
+ if (!LHSTy.isVector() && LHSTy.getSizeInBits() <= 64) {
+ emitCBZ(LHS, /*IsNegative = */ Pred == CmpInst::ICMP_NE, DestMBB, MIB);
----------------
The type must be <= 64 for scalars right?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92358/new/
https://reviews.llvm.org/D92358
More information about the llvm-commits
mailing list