[llvm] [RISCV] Hoist immediate addresses from loads/stores (PR #83644)

Wang Pengcheng via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 3 22:39:03 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:

Can you add a test for this case?

https://github.com/llvm/llvm-project/pull/83644


More information about the llvm-commits mailing list