[PATCH] D129948: [RISCV] Fold stack reload into sext.w by using lw instead of ld.
Alex Bradbury via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 17 08:43:17 PDT 2022
asb added inline comments.
================
Comment at: llvm/lib/Target/RISCV/RISCVInstrInfo.cpp:648
+ // TODO: Fold with sext.b, sext.h, zext.b, zext.h, zext.w?
+ if (Ops.size() == 1 && Ops[0] == 1 && MI.getOpcode() == RISCV::ADDIW &&
+ MI.getOperand(2).isImm() && MI.getOperand(2).getImm() == 0) {
----------------
It would probably be a minor improvement in readability to define a isSEXTW helper and use it here and in RISCVSExtWRemoval.
================
Comment at: llvm/lib/Target/RISCV/RISCVInstrInfo.cpp:650
+ MI.getOperand(2).isImm() && MI.getOperand(2).getImm() == 0) {
+ MachineMemOperand *MMO = MF.getMachineMemOperand(
+ MachinePointerInfo::getFixedStack(MF, FrameIndex),
----------------
I think you could ditch this and replace the .addMemOperand below with `.setMemRefs(MI.memoperands())`
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129948/new/
https://reviews.llvm.org/D129948
More information about the llvm-commits
mailing list