[llvm] c53d99c - [RISCV] Split f64 undef into two i32 undefs
via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 7 21:43:38 PST 2022
Author: wangpc
Date: 2022-02-08T13:42:15+08:00
New Revision: c53d99c37de5028beca32416727e609d2dffacba
URL: https://github.com/llvm/llvm-project/commit/c53d99c37de5028beca32416727e609d2dffacba
DIFF: https://github.com/llvm/llvm-project/commit/c53d99c37de5028beca32416727e609d2dffacba.diff
LOG: [RISCV] Split f64 undef into two i32 undefs
So that no store instruction will be generated.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D118222
Added:
Modified:
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/test/CodeGen/RISCV/double-calling-conv.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index c6abad23b5aea..7dd56d4bb04b1 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -7796,6 +7796,12 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N,
if (Op0->getOpcode() == RISCVISD::BuildPairF64)
return DCI.CombineTo(N, Op0.getOperand(0), Op0.getOperand(1));
+ if (Op0->isUndef()) {
+ SDValue Lo = DAG.getUNDEF(MVT::i32);
+ SDValue Hi = DAG.getUNDEF(MVT::i32);
+ return DCI.CombineTo(N, Lo, Hi);
+ }
+
SDLoc DL(N);
// It's cheaper to materialise two 32-bit integers than to load a double
diff --git a/llvm/test/CodeGen/RISCV/double-calling-conv.ll b/llvm/test/CodeGen/RISCV/double-calling-conv.ll
index 4ec95aa388f6a..054cba1130637 100644
--- a/llvm/test/CodeGen/RISCV/double-calling-conv.ll
+++ b/llvm/test/CodeGen/RISCV/double-calling-conv.ll
@@ -146,11 +146,6 @@ define double @caller_double_stack() nounwind {
define double @func_return_double_undef() nounwind {
; RV32IFD-LABEL: func_return_double_undef:
; RV32IFD: # %bb.0:
-; RV32IFD-NEXT: addi sp, sp, -16
-; RV32IFD-NEXT: fsd ft0, 8(sp)
-; RV32IFD-NEXT: lw a0, 8(sp)
-; RV32IFD-NEXT: lw a1, 12(sp)
-; RV32IFD-NEXT: addi sp, sp, 16
; RV32IFD-NEXT: ret
ret double undef
}
More information about the llvm-commits
mailing list