[llvm] 4a5f9d9 - [TargetLowering] Respect recursive depth in SimplifyDemandedBits call to ComputeNumSignBits

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 26 02:05:46 PST 2020


Author: Simon Pilgrim
Date: 2020-01-26T10:01:56Z
New Revision: 4a5f9d9faf738de6ddefeb8b742e76cbaf6edc60

URL: https://github.com/llvm/llvm-project/commit/4a5f9d9faf738de6ddefeb8b742e76cbaf6edc60
DIFF: https://github.com/llvm/llvm-project/commit/4a5f9d9faf738de6ddefeb8b742e76cbaf6edc60.diff

LOG: [TargetLowering] Respect recursive depth in SimplifyDemandedBits call to ComputeNumSignBits

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index e962b78ec306..82c22b944986 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -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.


        


More information about the llvm-commits mailing list