The first operand to AND does not always have more than two operands. This
authorChris Lattner <sabre@nondot.org>
Tue, 30 Aug 2005 00:59:16 +0000 (00:59 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 30 Aug 2005 00:59:16 +0000 (00:59 +0000)
fixes MediaBench/toast with the dag selector

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

lib/Target/PowerPC/PPCISelDAGToDAG.cpp

index a0af76570a9bd8d8146397b70121414cc1b4edbf..f2d65697da7a30b3b1ec32f1f6ceef9fba20cd86 100644 (file)
@@ -167,7 +167,8 @@ static bool isRotateAndMask(SDNode *N, unsigned Mask, bool IsShiftMask,
   unsigned Shift  = 32;
   unsigned Indeterminant = ~0;  // bit mask marking indeterminant results
   unsigned Opcode = N->getOpcode();
-  if (!isIntImmediate(N->getOperand(1).Val, Shift) || (Shift > 31))
+  if (N->getNumOperands() != 2 ||
+      !isIntImmediate(N->getOperand(1).Val, Shift) || (Shift > 31))
     return false;
   
   if (Opcode == ISD::SHL) {