[all-commits] [llvm/llvm-project] 5387a3: [SimpleLoopUnswitch] Freeze individual OR/AND oper...

Florian Hahn via All-commits all-commits at lists.llvm.org
Sun May 1 12:11:34 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5387a38c3891730b943a35d9d3e4b2d9e716acda
      https://github.com/llvm/llvm-project/commit/5387a38c3891730b943a35d9d3e4b2d9e716acda
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2022-05-01 (Sun, 01 May 2022)

  Changed paths:
    M llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
    M llvm/test/Transforms/SimpleLoopUnswitch/trivial-unswitch-freeze-individual-conditions.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/trivial-unswitch-logical-and-or.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/trivial-unswitch.ll

  Log Message:
  -----------
  [SimpleLoopUnswitch] Freeze individual OR/AND operands.

In some cases, it is not enough to freeze the final AND/OR operation
when chaining a number of invariant conditions together.

After creating a chain of ANDs/ORs, we assume all unswitched operands to
be either true or false. But if any of the operands is poison, the rest
of the operands could have any value after branching on the frozen
condition.

To avoid that, freeze individual operands, if needed. In some cases this
may lead to unnecessary freezes, but it seems required at least for some
cases (see trivial-unswitch-freeze-individual-conditions.ll)

Reviewed By: nikic

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




More information about the All-commits mailing list