summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorAhmed Bougacha <ahmed.bougacha@gmail.com>2016-04-12 18:15:39 +0000
committerAhmed Bougacha <ahmed.bougacha@gmail.com>2016-04-12 18:15:39 +0000
commit7ac86c47d2734cd83bfe757bc075f2827d6339f2 (patch)
tree3861b368cf6dec2ebe86c649ce8051ff5d44ddff /llvm/lib/CodeGen
parent5502e91c8b6a3f069f4c5770b7aaef9c8b0f002a (diff)
downloadbcm5719-llvm-7ac86c47d2734cd83bfe757bc075f2827d6339f2.tar.gz
bcm5719-llvm-7ac86c47d2734cd83bfe757bc075f2827d6339f2.zip
[CodeGen] Remove constant-folding dead code. NFC.
This code was specific to vector operations with scalar operands: all the opcodes in FoldValue (via FoldConstantArithmetic) can't match those criteria. Replace it with an assert if that ever changes: at that point, we might need to add back a splat BUILD_VECTOR. llvm-svn: 266100
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp16
1 files changed, 4 insertions, 12 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index a28ce41a660..955e4c6d5ab 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -3295,18 +3295,10 @@ SDValue SelectionDAG::FoldConstantArithmetic(unsigned Opcode, SDLoc DL, EVT VT,
// Handle the case of two scalars.
if (const ConstantSDNode *Scalar1 = dyn_cast<ConstantSDNode>(Cst1)) {
if (const ConstantSDNode *Scalar2 = dyn_cast<ConstantSDNode>(Cst2)) {
- if (SDValue Folded =
- FoldConstantArithmetic(Opcode, DL, VT, Scalar1, Scalar2)) {
- if (!VT.isVector())
- return Folded;
- SmallVector<SDValue, 4> Outputs;
- // We may have a vector type but a scalar result. Create a splat.
- Outputs.resize(VT.getVectorNumElements(), Outputs.back());
- // Build a big vector out of the scalar elements we generated.
- return getNode(ISD::BUILD_VECTOR, SDLoc(), VT, Outputs);
- } else {
- return SDValue();
- }
+ SDValue Folded = FoldConstantArithmetic(Opcode, DL, VT, Scalar1, Scalar2);
+ assert((!Folded || !VT.isVector()) &&
+ "Can't fold vectors ops with scalar operands");
+ return Folded;
}
}
OpenPOWER on IntegriCloud