[llvm] [RISCV] Add a pass to remove ADDI by reassociating to fold into load/store address. (PR #127151)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 13 23:22:52 PST 2025
================
@@ -1205,12 +1205,11 @@ define i32 @crash() {
;
; RV64I-LARGE-LABEL: crash:
; RV64I-LARGE: # %bb.0: # %entry
-; RV64I-LARGE-NEXT: li a0, 1
; RV64I-LARGE-NEXT: .Lpcrel_hi15:
-; RV64I-LARGE-NEXT: auipc a1, %pcrel_hi(.LCPI21_0)
-; RV64I-LARGE-NEXT: ld a1, %pcrel_lo(.Lpcrel_hi15)(a1)
-; RV64I-LARGE-NEXT: add a0, a1, a0
-; RV64I-LARGE-NEXT: lbu a0, 400(a0)
+; RV64I-LARGE-NEXT: auipc a0, %pcrel_hi(.LCPI21_0)
+; RV64I-LARGE-NEXT: ld a0, %pcrel_lo(.Lpcrel_hi15)(a0)
+; RV64I-LARGE-NEXT: add a0, a0, zero
----------------
topperc wrote:
Yeah. I may need to do more explicit folding after the replacement.
https://github.com/llvm/llvm-project/pull/127151
More information about the llvm-commits
mailing list