[llvm] 0d19739 - [RISCV] Don't overcount FP constants in lowerBUILD_VECTOR
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Wed May 3 12:21:31 PDT 2023
Author: Philip Reames
Date: 2023-05-03T12:21:18-07:00
New Revision: 0d19739768d46b8e07d4fa44aea901a19ad8cd8d
URL: https://github.com/llvm/llvm-project/commit/0d19739768d46b8e07d4fa44aea901a19ad8cd8d
DIFF: https://github.com/llvm/llvm-project/commit/0d19739768d46b8e07d4fa44aea901a19ad8cd8d.diff
LOG: [RISCV] Don't overcount FP constants in lowerBUILD_VECTOR
If the value count is > 1, we use a splat and thus only materialize the constant once, not once per element.
Added:
Modified:
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 4eae05fa6e4d..336cbfc93874 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -3161,9 +3161,9 @@ static SDValue lowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG,
ValueCounts.insert(std::make_pair(V, 0));
unsigned &Count = ValueCounts[V];
-
- if (auto *CFP = dyn_cast<ConstantFPSDNode>(V))
- NumScalarLoads += !CFP->isExactlyValue(+0.0);
+ if (0 == Count)
+ if (auto *CFP = dyn_cast<ConstantFPSDNode>(V))
+ NumScalarLoads += !CFP->isExactlyValue(+0.0);
// Is this value dominant? In case of a tie, prefer the highest element as
// it's cheaper to insert near the beginning of a vector than it is at the
More information about the llvm-commits
mailing list