[llvm] r293414 - [DAGCombiner] Use unsigned for a constant vector index instead of APInt.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 28 20:38:22 PST 2017


Author: ctopper
Date: Sat Jan 28 22:38:21 2017
New Revision: 293414

URL: http://llvm.org/viewvc/llvm-project?rev=293414&view=rev
Log:
[DAGCombiner] Use unsigned for a constant vector index instead of APInt.

The type system requires that the number of vector elements should fit in 32-bits so this should be safe.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=293414&r1=293413&r2=293414&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Sat Jan 28 22:38:21 2017
@@ -14543,8 +14543,8 @@ SDValue DAGCombiner::visitINSERT_SUBVECT
   // 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)




More information about the llvm-commits mailing list