HomePhabricator

[JumpThreading] Change asserts for WantInteger into actual checks

Authored by paquette on Apr 2 2021, 1:16 PM.

Description

[JumpThreading] Change asserts for WantInteger into actual checks

After e734e8286b4b521d829aaddb6d1cbbd264953625, it is possible to end up in
a situation where an indirectbr is fed by a cast, which is in turn fed by
an operation which only produces integers.

indirectbr expects a block address, however these operations can't produce
that.

There were several asserts in computeValueKnownInPredecessorsImpl which check
that we're not looking for a block address if we're walking through something
which can never produce one.

Since it's now possible to hit these asserts, this changes them into actual
checks which return false if Preference is not WantInteger.

This adds a testcase which verifies that we don't crash anymore in these
situations.

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