[SelectionDAG] Check for any recursion depth greater than or equal to limit instead...
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sat, 27 Jul 2019 12:48:46 +0000 (12:48 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sat, 27 Jul 2019 12:48:46 +0000 (12:48 +0000)
commit8a5267178208c4f857afe7b84f45f1d0678282c7
tree53f1b3ee3b5ca04a34a1039e7fb615559da9b9fc
parent51bfb84852e5c3bf746a34a455504c70540a55c3
[SelectionDAG] Check for any recursion depth greater than or equal to limit instead of just equal the limit.

If anything called the recursive isKnownNeverNaN/computeKnownBits/ComputeNumSignBits/SimplifyDemandedBits/SimplifyMultipleUseDemandedBits with an incorrect depth then we could continue to recurse if we'd already exceeded the depth limit.

This replaces the limit check (Depth == 6) with a (Depth >= 6) to make sure that we don't circumvent it.

This causes a couple of regressions as a mixture of calls (SimplifyMultipleUseDemandedBits + combineX86ShufflesRecursively) were calling with depths that were already over the limit. I've fixed SimplifyMultipleUseDemandedBits to not do this. combineX86ShufflesRecursively is trickier as we get a lot of regressions if we reduce its own limit from 8 to 6 (it also starts at Depth == 1 instead of Depth == 0 like the others....) - I'll see what I can do in future patches.

llvm-svn: 367171
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/test/CodeGen/AArch64/bitfield-insert.ll
llvm/test/CodeGen/AMDGPU/idot8s.ll
llvm/test/CodeGen/AMDGPU/idot8u.ll
llvm/test/CodeGen/X86/vector-fshl-rot-512.ll
llvm/test/CodeGen/X86/vector-fshr-rot-512.ll
llvm/test/CodeGen/X86/vector-trunc-packus-widen.ll
llvm/test/CodeGen/X86/vector-trunc-packus.ll