[X86] Return from SimplifyDemandedBitsForTargetNode after calculating known bits...
authorCraig Topper <craig.topper@intel.com>
Sat, 19 Sep 2020 06:37:50 +0000 (23:37 -0700)
committerCraig Topper <craig.topper@intel.com>
Sat, 19 Sep 2020 06:57:01 +0000 (23:57 -0700)
We were breaking out of the switch which falls into the default
implementation of SimplifyDemandedBitsForTargetNode which is a
wrapper around computeKnownBits. So we end up doing the recursion
and known bits calculation all over again. Instead we should return
with the known bits we calculated in the switch.

llvm/lib/Target/X86/X86ISelLowering.cpp

index 2070517..9ff0f51 100644 (file)
@@ -38084,7 +38084,7 @@ bool X86TargetLowering::SimplifyDemandedBitsForTargetNode(
 
     // Low bits known zero.
     Known.Zero.setLowBits(ShAmt);
-    break;
+    return false;
   }
   case X86ISD::VSRLI: {
     unsigned ShAmt = Op.getConstantOperandVal(1);
@@ -38103,7 +38103,7 @@ bool X86TargetLowering::SimplifyDemandedBitsForTargetNode(
 
     // High bits known zero.
     Known.Zero.setHighBits(ShAmt);
-    break;
+    return false;
   }
   case X86ISD::VSRAI: {
     SDValue Op0 = Op.getOperand(0);
@@ -38152,7 +38152,7 @@ bool X86TargetLowering::SimplifyDemandedBitsForTargetNode(
     // High bits are known one.
     if (Known.One[BitWidth - ShAmt - 1])
       Known.One.setHighBits(ShAmt);
-    break;
+    return false;
   }
   case X86ISD::PEXTRB:
   case X86ISD::PEXTRW: {