summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2013-07-09 18:55:10 +0000
committerHal Finkel <hfinkel@anl.gov>2013-07-09 18:55:10 +0000
commite4dd5c29f084bcbf481ab0a4dc2d136f7940c0cc (patch)
tree284b9946a58a9f96b32cc9b5a9d3361199ca7e76 /llvm/lib/CodeGen
parent41221693082ec891ea0bb312cab17ce8b8b7e10e (diff)
downloadbcm5719-llvm-e4dd5c29f084bcbf481ab0a4dc2d136f7940c0cc.tar.gz
bcm5719-llvm-e4dd5c29f084bcbf481ab0a4dc2d136f7940c0cc.zip
WidenVecRes_BUILD_VECTOR must use the first operand's type
Because integer BUILD_VECTOR operands may have a larger type than the result's vector element type, and all operands must have the same type, when widening a BUILD_VECTOR node by adding UNDEFs, we cannot use the vector element type, but rather must use the type of the existing operands. Another bug found by llvm-stress. llvm-svn: 185960
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
index 2a5d7216a97..2cd59ac0814 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
@@ -1872,7 +1872,10 @@ SDValue DAGTypeLegalizer::WidenVecRes_BUILD_VECTOR(SDNode *N) {
SDLoc dl(N);
// Build a vector with undefined for the new nodes.
EVT VT = N->getValueType(0);
- EVT EltVT = VT.getVectorElementType();
+
+ // Integer BUILD_VECTOR operands may be larger than the node's vector element
+ // type. The UNDEFs need to have the same type as the existing operands.
+ EVT EltVT = N->getOperand(0).getValueType();
unsigned NumElts = VT.getVectorNumElements();
EVT WidenVT = TLI.getTypeToTransformTo(*DAG.getContext(), VT);
OpenPOWER on IntegriCloud