[all-commits] [llvm/llvm-project] 67d453: [SimpleLoopUnswitch][NFC] Add tests for and/or con...

Joshua Cao via All-commits all-commits at lists.llvm.org
Wed Jun 14 00:53:45 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 67d4538a81f89108c23369c7e8385b88185ad0a2
      https://github.com/llvm/llvm-project/commit/67d4538a81f89108c23369c7e8385b88185ad0a2
  Author: Joshua Cao <cao.joshua at yahoo.com>
  Date:   2023-06-14 (Wed, 14 Jun 2023)

  Changed paths:
    M llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-select.ll

  Log Message:
  -----------
  [SimpleLoopUnswitch][NFC] Add tests for and/or conditions of selects


  Commit: 2f171b275f71f5f753980bfcbb2b1aeaa2b3701a
      https://github.com/llvm/llvm-project/commit/2f171b275f71f5f753980bfcbb2b1aeaa2b3701a
  Author: Joshua Cao <cao.joshua at yahoo.com>
  Date:   2023-06-14 (Wed, 14 Jun 2023)

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

  Log Message:
  -----------
  [SimpleLoopUnswitch] Unswitch AND/OR conditions of selects

If a select's condition is a AND/OR, we can unswitch invariant operands.
This patch uses existing logic from unswitching AND/OR's for branch
conditions.

This patch fixes the Cost computation for unswitching selects to have
the cost of the entire loop, since unswitching selects do not remove
branches. This is required for this patch because otherwise, there are
cases where unswitching selects of AND/OR is beating out unswitching of
branches.

This patch also prevents unswitching of logical AND/OR selects. This
should instead be done by unswitching of AND/OR branch conditions.

Reviewed By: nikic

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


Compare: https://github.com/llvm/llvm-project/compare/80853a16738f...2f171b275f71


More information about the All-commits mailing list