[ValueTracking] Fix endless recursion in isKnownNonZero()

Summary:
The isKnownNonZero() function have checks that abort the recursion when
it reaches the specified max depth. However one of the recursive calls
was placed before the max depth check was done, resulting in a endless
recursion that eventually triggered a segmentation fault.

Fixed the problem by moving the max depth check above the first
recursive call.

Reviewers: Prazek, nlopes, spatel, craig.topper, hfinkel

Reviewed By: hfinkel

Subscribers: hfinkel, bjope, llvm-commits

Differential Revision: https://reviews.llvm.org/D47531

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333557 91177308-0d34-0410-b5e6-96231b3b80d8
2 files changed