[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.

llvm-svn: 367169
This commit is contained in:
Simon Pilgrim 2019-07-27 12:23:36 +00:00
parent 6faac434ed
commit 3ff6126487
1 changed files with 3 additions and 0 deletions

View File

@ -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: {