[all-commits] [llvm/llvm-project] bdd52e: [Test] Add a test exposing a miscompile in SimpleL...

Daniil Suchkov via All-commits all-commits at lists.llvm.org
Fri Oct 1 14:31:43 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bdd52e8baedd4e37598efd30692a8541a26f61a1
      https://github.com/llvm/llvm-project/commit/bdd52e8baedd4e37598efd30692a8541a26f61a1
  Author: Daniil Suchkov <dsuchkov at azul.com>
  Date:   2021-10-01 (Fri, 01 Oct 2021)

  Changed paths:
    A llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-invariant-select-bug.ll

  Log Message:
  -----------
  [Test] Add a test exposing a miscompile in SimpleLoopUnswitch.

The miscompile was introduced by 6b4b1dc6ec6f0bf0a1bb414fbe751ccab99d41a0.


  Commit: 45bd8d947780811aa4a6ba7e6b42e3a2dce3e6bd
      https://github.com/llvm/llvm-project/commit/45bd8d947780811aa4a6ba7e6b42e3a2dce3e6bd
  Author: Daniil Suchkov <dsuchkov at azul.com>
  Date:   2021-10-01 (Fri, 01 Oct 2021)

  Changed paths:
    M llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
    M llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-invariant-select-bug.ll

  Log Message:
  -----------
  [SimpleLoopUnswitch] Don't unswitch constant conditions

Added an additional check for constants after simplification of
"select _, true, false" pattern. We need to prevent attempts to unswitch constant
conditions for two reasons:
a) Doing that doesn't make any sense, in the best case it will just burn
some compile time.
b) SimpleLoopUnswitch isn't designed to unswitch constant conditions
(due to (a)), so attempting that can cause miscompiles. The attached
testcase is an example of such miscompile.

Also added an assertion that'll make sure we aren't trying to replace
constants, so it will help us prevent such bugs in future. The assertion
from D110751 is another layer of protection against such cases.

Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D110752


  Commit: 86046516e4f4527213c595c154c9971d81a49601
      https://github.com/llvm/llvm-project/commit/86046516e4f4527213c595c154c9971d81a49601
  Author: Daniil Suchkov <dsuchkov at azul.com>
  Date:   2021-10-01 (Fri, 01 Oct 2021)

  Changed paths:
    M llvm/include/llvm/Support/GenericDomTree.h

  Log Message:
  -----------
  [DomTree] Assert that blocks in queries aren't from another function

This assertion should help us catch cases when DT is used in a way that
doesn't make much sense and usually indicates usage errors. In D110752
you can see a test on which this assertion catches a miscompile.

The assertion is added to getNode since all queries seem to be
routed through that function for all non-trivial cases.

Reviewed By: aeubanks, MaskRay
Differential Revision: https://reviews.llvm.org/D110751


Compare: https://github.com/llvm/llvm-project/compare/af7ac1d95b7d...86046516e4f4


More information about the All-commits mailing list