From: Simon Pilgrim Date: Sat, 27 Jul 2019 12:23:36 +0000 (+0000) Subject: [TargetLowering] Add depth limit to SimplifyMultipleUseDemandedBits X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5972aca6bec62c139a364ad0b672f0005807125e;p=llvm [TargetLowering] Add depth limit to SimplifyMultipleUseDemandedBits We're getting reports of massive compile time increases because SimplifyMultipleUseDemandedBits was losing track of the depth and not earlying-out. No repro yet, but consider this a pre-emptive commit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367169 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/lib/CodeGen/SelectionDAG/TargetLowering.cpp index 6bfb388a3f7..1173beb9ac6 100644 --- a/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -569,6 +569,9 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op, const APInt &DemandedBits, SDValue TargetLowering::SimplifyMultipleUseDemandedBits( SDValue Op, const APInt &DemandedBits, const APInt &DemandedElts, SelectionDAG &DAG, unsigned Depth) const { + if (Depth == 6) // Limit search depth. + return SDValue(); + KnownBits LHSKnown, RHSKnown; switch (Op.getOpcode()) { case ISD::AND: {