[llvm] 592e89e - [DAG] Constify SelectionDAG::isSplatValue()
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 21 03:19:50 PST 2021
Author: Simon Pilgrim
Date: 2021-12-21T11:19:23Z
New Revision: 592e89e636d8da4e003ff6ea2c8483fa921b90dc
URL: https://github.com/llvm/llvm-project/commit/592e89e636d8da4e003ff6ea2c8483fa921b90dc
DIFF: https://github.com/llvm/llvm-project/commit/592e89e636d8da4e003ff6ea2c8483fa921b90dc.diff
LOG: [DAG] Constify SelectionDAG::isSplatValue()
This doesn't generate any nodes so should be usable by methods with const SelectionDAG &.
Added:
Modified:
llvm/include/llvm/CodeGen/SelectionDAG.h
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/SelectionDAG.h b/llvm/include/llvm/CodeGen/SelectionDAG.h
index 5a3f4e9a23fff..d21844555f5bf 100644
--- a/llvm/include/llvm/CodeGen/SelectionDAG.h
+++ b/llvm/include/llvm/CodeGen/SelectionDAG.h
@@ -1912,10 +1912,10 @@ class SelectionDAG {
///
/// NOTE: The function will return true for a demanded splat of UNDEF values.
bool isSplatValue(SDValue V, const APInt &DemandedElts, APInt &UndefElts,
- unsigned Depth = 0);
+ unsigned Depth = 0) const;
/// Test whether \p V has a splatted value.
- bool isSplatValue(SDValue V, bool AllowUndefs = false);
+ bool isSplatValue(SDValue V, bool AllowUndefs = false) const;
/// If V is a splatted value, return the source vector and its splat index.
SDValue getSplatSourceVector(SDValue V, int &SplatIndex);
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index ad8304e023f5b..0e2fe8bf54eb1 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -2499,7 +2499,7 @@ bool SelectionDAG::MaskedValueIsAllOnes(SDValue V, const APInt &Mask,
/// sense to specify which elements are demanded or undefined, therefore
/// they are simply ignored.
bool SelectionDAG::isSplatValue(SDValue V, const APInt &DemandedElts,
- APInt &UndefElts, unsigned Depth) {
+ APInt &UndefElts, unsigned Depth) const {
EVT VT = V.getValueType();
assert(VT.isVector() && "Vector type expected");
@@ -2623,7 +2623,7 @@ bool SelectionDAG::isSplatValue(SDValue V, const APInt &DemandedElts,
}
/// Helper wrapper to main isSplatValue function.
-bool SelectionDAG::isSplatValue(SDValue V, bool AllowUndefs) {
+bool SelectionDAG::isSplatValue(SDValue V, bool AllowUndefs) const {
EVT VT = V.getValueType();
assert(VT.isVector() && "Vector type expected");
More information about the llvm-commits
mailing list