[all-commits] [llvm/llvm-project] acb8de: [JumpThreading] Change asserts for WantInteger int...

Jessica Paquette via All-commits all-commits at lists.llvm.org
Fri Jan 14 11:15:30 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: acb8de565eaa2638d18362085085deb4628435b4
      https://github.com/llvm/llvm-project/commit/acb8de565eaa2638d18362085085deb4628435b4
  Author: Jessica Paquette <jpaquette at apple.com>
  Date:   2022-01-14 (Fri, 14 Jan 2022)

  Changed paths:
    M llvm/lib/Transforms/Scalar/JumpThreading.cpp
    A llvm/test/Transforms/JumpThreading/indirectbr-cast-int-op.ll

  Log Message:
  -----------
  [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




More information about the All-commits mailing list