Fix a bug in ISD::isBuildVectorAllOnesInteger that caused it to always return
authorChris Lattner <sabre@nondot.org>
Sat, 25 Mar 2006 22:59:28 +0000 (22:59 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 25 Mar 2006 22:59:28 +0000 (22:59 +0000)
false

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

lib/CodeGen/SelectionDAG/SelectionDAG.cpp

index 9fcfc61af79e7cec08df338ac31331eac95b977d..18e2ebcb45ee75cb43c145d70c792db7562aea1f 100644 (file)
@@ -86,12 +86,13 @@ bool ISD::isBuildVectorAllOnesInteger(const SDNode *N) {
   
   // Do not accept build_vectors that aren't all constants or which have non-~0
   // elements.
-  if (!isa<ConstantSDNode>(N) || !cast<ConstantSDNode>(N)->isAllOnesValue())
+  SDOperand NotZero = N->getOperand(i);
+  if (!isa<ConstantSDNode>(NotZero) ||
+      !cast<ConstantSDNode>(NotZero)->isAllOnesValue())
     return false;
   
   // Okay, we have at least one ~0 value, check to see if the rest match or are
   // undefs.
-  SDOperand NotZero = N->getOperand(i);
   for (++i; i != e; ++i)
     if (N->getOperand(i) != NotZero &&
         N->getOperand(i).getOpcode() != ISD::UNDEF)