[PATCH] D99814: [JumpThreading] Change asserts for WantInteger into actual checks

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 2 13:27:17 PDT 2021


paquette created this revision.
paquette added reviewers: aqjune, lebedev.ri, nikic.
Herald added a subscriber: hiraditya.
paquette requested review of this revision.
Herald added a project: LLVM.

After e734e8286b4b521d829aaddb6d1cbbd264953625 <https://reviews.llvm.org/rGe734e8286b4b521d829aaddb6d1cbbd264953625>, 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.


https://reviews.llvm.org/D99814

Files:
  llvm/lib/Transforms/Scalar/JumpThreading.cpp
  llvm/test/Transforms/JumpThreading/indirectbr-cast-int-op.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99814.335019.patch
Type: text/x-patch
Size: 3819 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210402/8dc27d71/attachment.bin>


More information about the llvm-commits mailing list