[llvm] [RISCV] Fold `addi` into load / store even if they are in different BBs. (PR #67024)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 22 11:36:58 PDT 2023
================
@@ -2278,6 +2279,81 @@ bool RISCVTargetLowering::isLegalElementTypeForRVV(EVT ScalarTy) const {
}
}
+static bool tryToFoldInstIntoUse(MachineInstr &UseMI, MachineInstr &MI) {
+
+ if (MI.getOpcode() != RISCV::ADDI)
+ return false;
+ if (!(MI.getOperand(0).isReg() && MI.getOperand(1).isReg()))
+ return false;
+
+ switch (UseMI.getOpcode()) {
+ default:
+ return false;
+ case RISCV::LB:
+ case RISCV::LH:
+ case RISCV::LW:
+ case RISCV::LD:
+ case RISCV::LBU:
+ case RISCV::LHU:
+ case RISCV::SB:
+ case RISCV::SH:
+ case RISCV::SW:
+ case RISCV::SD:
----------------
topperc wrote:
you're also missing LWU
https://github.com/llvm/llvm-project/pull/67024
More information about the llvm-commits
mailing list