summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2018-02-08 18:55:14 +0000
committerCraig Topper <craig.topper@intel.com>2018-02-08 18:55:14 +0000
commit9b611e436fbf9f973bb154da477463ae8e8a2c52 (patch)
treec9817972e40125d0eb6cc2167e27fc3ff32828be /llvm/include
parent08d829da3e92f193335e999da331e0f9945d4003 (diff)
downloadbcm5719-llvm-9b611e436fbf9f973bb154da477463ae8e8a2c52.tar.gz
bcm5719-llvm-9b611e436fbf9f973bb154da477463ae8e8a2c52.zip
[SelectionDAG] Add a helper function for creating a boolean constant based on the target's boolean content
Many in SimplifySetCC and FoldSetCC try to create true or false constants. Some of them query getBooleanContents to figure out whether to use all ones or just 1 for true. But many places do not check and just use 1 without ensuring the VT has an i1 scalar type. Note sure if those places only trigger before type legalization so they only see an i1 type? To cleanup the inconsistency and reduce some duplicated code, this patch adds a getBoolConstant method to SelectionDAG that takes are of querying getBooleanContents and doing the right thing. Differential Revision: https://reviews.llvm.org/D43037 llvm-svn: 324634
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/CodeGen/SelectionDAG.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/include/llvm/CodeGen/SelectionDAG.h b/llvm/include/llvm/CodeGen/SelectionDAG.h
index 28a34597401..cf8618b76e2 100644
--- a/llvm/include/llvm/CodeGen/SelectionDAG.h
+++ b/llvm/include/llvm/CodeGen/SelectionDAG.h
@@ -570,6 +570,10 @@ public:
bool isOpaque = false) {
return getConstant(Val, DL, VT, true, isOpaque);
}
+
+ /// \brief Create a true or false constant of type \p VT using the target's
+ /// BooleanContent for type \p OpVT.
+ SDValue getBoolConstant(bool V, const SDLoc &DL, EVT VT, EVT OpVT);
/// @}
/// \brief Create a ConstantFPSDNode wrapping a constant value.
OpenPOWER on IntegriCloud