Port the fix for the select operator from instcombine's
authorDan Gohman <gohman@apple.com>
Tue, 20 May 2008 20:59:51 +0000 (20:59 +0000)
committerDan Gohman <gohman@apple.com>
Tue, 20 May 2008 20:59:51 +0000 (20:59 +0000)
ComputeNumSignBits to SelectionDAG's ComputeNumSignBits.

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

lib/CodeGen/SelectionDAG/SelectionDAG.cpp

index 83e773ed313d4454107272ed24255df3c442ae1b..c46271a2b765a1f9823f0e1bbf007c59b179836b 100644 (file)
@@ -1690,9 +1690,9 @@ unsigned SelectionDAG::ComputeNumSignBits(SDOperand Op, unsigned Depth) const{
     return std::min(Tmp, Tmp2);
 
   case ISD::SELECT:
-    Tmp = ComputeNumSignBits(Op.getOperand(0), Depth+1);
+    Tmp = ComputeNumSignBits(Op.getOperand(1), Depth+1);
     if (Tmp == 1) return 1;  // Early out.
-    Tmp2 = ComputeNumSignBits(Op.getOperand(1), Depth+1);
+    Tmp2 = ComputeNumSignBits(Op.getOperand(2), Depth+1);
     return std::min(Tmp, Tmp2);
     
   case ISD::SETCC: