[all-commits] [llvm/llvm-project] 5fe915: [SCEV] Canonicalize ext(min/max(x, y)) to min/max(...

Max Kazantsev via All-commits all-commits at lists.llvm.org
Mon Feb 20 01:13:13 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5fe915bb8c6b963be9c8617fa50aa4d9c1e304fc
      https://github.com/llvm/llvm-project/commit/5fe915bb8c6b963be9c8617fa50aa4d9c1e304fc
  Author: Max Kazantsev <mkazantsev at azul.com>
  Date:   2023-02-20 (Mon, 20 Feb 2023)

  Changed paths:
    M llvm/lib/Analysis/ScalarEvolution.cpp
    M llvm/test/Analysis/ScalarEvolution/ext_min_max.ll
    M llvm/test/Analysis/ScalarEvolution/fold.ll
    M llvm/test/Analysis/ScalarEvolution/logical-operations.ll
    M llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info-rewrite-expressions.ll
    M llvm/test/Analysis/ScalarEvolution/ptrtoint.ll
    M llvm/test/Analysis/ScalarEvolution/range_nw_flag.ll

  Log Message:
  -----------
  [SCEV] Canonicalize ext(min/max(x, y)) to min/max(ext(x), ext(y))

I stumbled over this while trying to improve our exit count work. These expressions
are equivalent for complementary signed/unsigned ext and min/max (including umin_seq),
but they are not canonicalized and SCEV cannot recognize them as the same.

The benefit of this canonicalization is that SCEV can prove some new equivalences which
it coudln't prove because of different forms. There is 1 test where trip count seems pessimized,
I could not directly figure out why, but it just seems an unrelated issue that we can fix.
Other changes seem neutral or positive to me.

Differential Revision: https://reviews.llvm.org/D141481
Reviewed By: nikic




More information about the All-commits mailing list