[all-commits] [llvm/llvm-project] e9a1c8: [SCEVExpander] Expand umin_seq using freeze

Nikita Popov via All-commits all-commits at lists.llvm.org
Wed May 18 00:54:34 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e9a1c82d695472820c93af40cbf3d9fde2a149c6
      https://github.com/llvm/llvm-project/commit/e9a1c82d695472820c93af40cbf3d9fde2a149c6
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-05-18 (Wed, 18 May 2022)

  Changed paths:
    M llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h
    M llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
    M llvm/test/Transforms/IndVarSimplify/exit-count-select.ll

  Log Message:
  -----------
  [SCEVExpander] Expand umin_seq using freeze

%x umin_seq %y is currently expanded to %x == 0 ? 0 : umin(%x, %y).
This patch changes the expansion to umin(%x, freeze %y) instead
(https://alive2.llvm.org/ce/z/wujUhp).

The motivation for this change are the test cases affected by
D124910, where the freeze expansion ultimately produces better
optimization results. This is largely because
`(%x umin_seq %y) == %x` is a common expansion pattern, which
reliably optimizes in freeze representation, but only sometimes
with the zero comparison (in particular, if %x == 0 can fold to
something else, we generally won't be able to cover reasonable
code from this.)

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




More information about the All-commits mailing list