diff options
author | Nadav Rotem <nadav.rotem@intel.com> | 2011-09-25 18:59:42 +0000 |
---|---|---|
committer | Nadav Rotem <nadav.rotem@intel.com> | 2011-09-25 18:59:42 +0000 |
commit | 0eba4fe292a0bb343da5fb2667850a39459cef0b (patch) | |
tree | d81babb208248631db959d4b091eaf4c756091b6 /lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp | |
parent | 74e2d6ea66a9289fc3c00583f3c2b2abd84e1866 (diff) |
[vector-select] Address one of the issues in pr10902. EXTRACT_VECTOR_ELEMENT
SDNodes may return values which are wider than the incoming element types. In
this patch we fix the integer promotion of these nodes.
Fixes spill-q.ll when running -promote-elements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140471 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp index fc9a41ecaa..80857e154a 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp @@ -2987,8 +2987,13 @@ SDValue DAGTypeLegalizer::PromoteIntOp_EXTRACT_VECTOR_ELT(SDNode *N) { SDValue Ext = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, V0->getValueType(0).getScalarType(), V0, V1); - return DAG.getNode(ISD::TRUNCATE, dl, N->getValueType(0), Ext); - + // EXTRACT_VECTOR_ELT can return types which are wider than the incoming + // element types (see PromoteIntRes_EXTRACT_VECTOR_ELT). If this is the case + // then we need to expand the outgoing value and not truncate it. + bool trunc = (N->getValueType(0).getSizeInBits() < + Ext.getValueType().getSizeInBits()); + return DAG.getNode(trunc ? ISD::TRUNCATE : ISD::ANY_EXTEND, + dl, N->getValueType(0), Ext); } SDValue DAGTypeLegalizer::PromoteIntOp_CONCAT_VECTORS(SDNode *N) { |