[llvm] [RISCV] Hoist immediate addresses from loads/stores (PR #83644)
Wang Pengcheng via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 3 19:33:48 PST 2024
================
@@ -162,6 +162,14 @@ InstructionCost RISCVTTIImpl::getIntImmCostInst(unsigned Opcode, unsigned Idx,
// split up large offsets in GEP into better parts than ConstantHoisting
// can.
return TTI::TCC_Free;
+ case Instruction::Store:
+ // If the address is a constant, use the materialization cost.
+ if (Idx == 1)
+ return getIntImmCost(Imm, Ty, CostKind);
----------------
wangpc-pp wrote:
For addresses in [0, 2048), we can use `ld/sd a0, offset(zero)`.
(though I don't know if this is a common case)
https://github.com/llvm/llvm-project/pull/83644
More information about the llvm-commits
mailing list