mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
[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
This commit is contained in:
parent
cf74ca3a3d
commit
9e606d4f83
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user