From 0f75548f9fdbdedf36c1ea732d715a419186b7a1 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Wed, 26 Apr 2017 13:27:57 +0000 Subject: [PATCH] [DAG] add FIXME comments for splat detection; NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301403 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 4 ++++ lib/CodeGen/SelectionDAG/TargetLowering.cpp | 3 +++ 2 files changed, 7 insertions(+) diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index f30c58112a8..63db98afecd 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -7640,6 +7640,8 @@ bool BuildVectorSDNode::isConstantSplat(APInt &SplatValue, APInt &SplatUndef, if (MinSplatBits > VecWidth) return false; + // FIXME: The widths are based on this node's type, but build vectors can + // truncate their operands. SplatValue = APInt(VecWidth, 0); SplatUndef = APInt(VecWidth, 0); @@ -7669,6 +7671,8 @@ bool BuildVectorSDNode::isConstantSplat(APInt &SplatValue, APInt &SplatUndef, // The build_vector is all constants or undefs. Find the smallest element // size that splats the vector. HasAnyUndefs = (SplatUndef != 0); + + // FIXME: This does not work for vectors with elements less than 8 bits. while (VecWidth > 8) { unsigned HalfSize = VecWidth / 2; APInt HighValue = SplatValue.lshr(HalfSize).trunc(HalfSize); diff --git a/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/lib/CodeGen/SelectionDAG/TargetLowering.cpp index afcdb6ce015..18b238d4e35 100644 --- a/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -1364,6 +1364,9 @@ unsigned TargetLowering::ComputeNumSignBitsForTargetNode(SDValue Op, return 1; } +// FIXME: Ideally, this would use ISD::isConstantSplatVector(), but that must +// work with truncating build vectors and vectors with elements of less than +// 8 bits. bool TargetLowering::isConstTrueVal(const SDNode *N) const { if (!N) return false; -- 2.50.1