[PATCH] D130931: [RISCV] Teach RISCVMergeBaseOffset to merge %lo/%pcrel_lo into load/store after folding arithmetic.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 1 16:05:11 PDT 2022


craig.topper added inline comments.


================
Comment at: llvm/test/CodeGen/RISCV/hoist-global-addr-base.ll:392-402
+entry:
+  %0 = load i8, i8* getelementptr inbounds ([0 x i8], [0 x i8]* @bar, i32 0, i64 3211)
+  %cmp = icmp sgt i8 %0, 0
+  br i1 %cmp, label %if.then, label %if.end
+
+if.then:                                          ; preds = %entry
+  store i8 10, i8* getelementptr inbounds ([0 x i8], [0 x i8]* @bar, i32 0, i64 3211)
----------------
luismarques wrote:
> Why was the branch needed here? Was there an issue with something simpler, like this?
> 
> ```
>   %x = load i8, i8* getelementptr inbounds ([0 x i8], [0 x i8]* @bar, i32 0, i64 3211)
>   %y = add i8 %x, 10
>   store i8 %y, i8* getelementptr inbounds ([0 x i8], [0 x i8]* @bar, i32 0, i64 3211)
> ```
No. I'll simplify it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130931/new/

https://reviews.llvm.org/D130931



More information about the llvm-commits mailing list