[llvm] [RISCV] Explicitly set FRM defs as non-dead to prevent their reordering with instructions that may use it (PR #135176)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 10 16:31:14 PDT 2025
topperc wrote:
> I think we might need a bigger hammer. This case also hoists but we don't need if @foo uses FRM or changes FRM.
>
> ```
> define double @bar(double %0, double %1, i64 %n) strictfp {
> entry:
> br label %loop
> loop:
> %cnt = phi i64 [0, %entry], [%cnt_inc, %loop]
> %acc = phi double [0.0, %entry], [%f2, %loop]
> call void @llvm.set.rounding(i32 2) strictfp
> %f1 = call double @foo(double %acc, double %0) strictfp
> call void @llvm.set.rounding(i32 1) strictfp
> %f2 = call double @foo(double %f1, double %1) strictfp
> %cnt_inc = add i64 %cnt, 1
> %cond = icmp eq i64 %cnt_inc, %n
> br i1 %cond, label %loop, label %exit
> exit:
> ret double %f2
> }
>
> declare double @foo(double, double)
> ```
Looks like this patch fixes this test case too.
https://github.com/llvm/llvm-project/pull/135176
More information about the llvm-commits
mailing list