From cba5d6bed85a43f15f10092552431c3000820392 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Fri, 18 Sep 2020 23:37:50 -0700 Subject: [PATCH] [X86] Return from SimplifyDemandedBitsForTargetNode after calculating known bits for VSHLI/VSRAI/VSRLI. 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. --- lib/Target/X86/X86ISelLowering.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 2070517f1e8..9ff0f511e07 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -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: {