diff options
author | Kevin Qin <Kevin.Qin@arm.com> | 2014-01-06 02:26:10 +0000 |
---|---|---|
committer | Kevin Qin <Kevin.Qin@arm.com> | 2014-01-06 02:26:10 +0000 |
commit | 5cd73c9e0a7af4047df073fb5395fe111ea627f6 (patch) | |
tree | fae4dc3091205a54dbe442efe2cad702c273ffd0 /llvm/lib/CodeGen | |
parent | 63c6b45a5aa86e8279b1582ef79416a59cec3ab0 (diff) | |
download | bcm5719-llvm-5cd73c9e0a7af4047df073fb5395fe111ea627f6.tar.gz bcm5719-llvm-5cd73c9e0a7af4047df073fb5395fe111ea627f6.zip |
[AArch64 NEON] Fix invalid constant used in vselect condition.
There is a wrong assumption that the vector element type and the
type of each ConstantSDNode in the build_vector were the same.
However, when promoting the integer operand of a legally typed
build_vector, the operand type and the vector element type do not
need to be the same
(See method 'DAGTypeLegalizer::PromoteIntOp_BUILD_VECTOR' in
LegalizeIntegerTypes.cpp).
in AArch64 backend, the following dag sequence:
C0: i1 = Constant<0>
C1: i1 = Constant<-1>
V: v8i1 = BUILD_VECTOR C1, C1, C0, C0, C0, C0, C0, C0
is type-legalized into:
NewC0: i32 = Constant<0>
NewC1: i32 = Constant<1>
V: v8i8 = BUILD_VECTOR NewC1, NewC1, NewC0, NewC0, NewC0, NewC0, NewC0, NewC0
Forcing a getZeroExtend to VTBits to ensure that the new constant
is correctly.
llvm-svn: 198582
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 3b87922b789..422e83ab7d5 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -5527,8 +5527,8 @@ SDValue DAGCombiner::visitSIGN_EXTEND_INREG(SDNode *N) { } ConstantSDNode *CurrentND = cast<ConstantSDNode>(Op); - const APInt &C = CurrentND->getAPIntValue(); - Elts.push_back(DAG.getConstant(C.shl(ShAmt).ashr(ShAmt), + const APInt &C = APInt(VTBits, CurrentND->getAPIntValue().getZExtValue()); + Elts.push_back(DAG.getConstant(C.shl(ShAmt).ashr(ShAmt).getZExtValue(), Op.getValueType())); } |