]> granicus.if.org Git - llvm/commitdiff
[DAGCombiner] Use unsigned for a constant vector index instead of APInt.
authorCraig Topper <craig.topper@gmail.com>
Sun, 29 Jan 2017 04:38:21 +0000 (04:38 +0000)
committerCraig Topper <craig.topper@gmail.com>
Sun, 29 Jan 2017 04:38:21 +0000 (04:38 +0000)
The type system requires that the number of vector elements should fit in 32-bits so this should be safe.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293414 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/DAGCombiner.cpp

index 3ef801f52a4cadceb1dfad4fdba7ced781145850..33863ca16f9ee59bbeb2a243fa5ff9ecb886d9d8 100644 (file)
@@ -14543,8 +14543,8 @@ SDValue DAGCombiner::visitINSERT_SUBVECTOR(SDNode *N) {
   // If the input vector is a concatenation, and the insert replaces
   // one of the halves, we can optimize into a single concat_vectors.
   if (N0.getOpcode() == ISD::CONCAT_VECTORS && N0->getNumOperands() == 2 &&
-      N2.getOpcode() == ISD::Constant) {
-    APInt InsIdx = cast<ConstantSDNode>(N2)->getAPIntValue();
+      isa<ConstantSDNode>(N2)) {
+    unsigned InsIdx = cast<ConstantSDNode>(N2)->getZExtValue();
 
     // Lower half: fold (insert_subvector (concat_vectors X, Y), Z) ->
     // (concat_vectors Z, Y)