[TargetLowering] Respect recursive depth in SimplifyDemandedBits call to ComputeNumSi...
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 26 Jan 2020 10:01:21 +0000 (10:01 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 26 Jan 2020 10:01:56 +0000 (10:01 +0000)
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp

index e962b78..82c22b9 100644 (file)
@@ -1629,7 +1629,8 @@ bool TargetLowering::SimplifyDemandedBits(
 
     // If we only care about the highest bit, don't bother shifting right.
     if (DemandedBits.isSignMask()) {
-      unsigned NumSignBits = TLO.DAG.ComputeNumSignBits(Op0);
+      unsigned NumSignBits =
+          TLO.DAG.ComputeNumSignBits(Op0, DemandedElts, Depth + 1);
       bool AlreadySignExtended = NumSignBits >= BitWidth - ExVTBits + 1;
       // However if the input is already sign extended we expect the sign
       // extension to be dropped altogether later and do not simplify.