[all-commits] [llvm/llvm-project] 660403: [SCEV] Fix finite loop non-strict predicate simpli...

Nikita Popov via All-commits all-commits at lists.llvm.org
Tue Mar 14 02:59:10 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 660403940ca33d84c20b1cae343655f3d7872ada
      https://github.com/llvm/llvm-project/commit/660403940ca33d84c20b1cae343655f3d7872ada
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-03-14 (Tue, 14 Mar 2023)

  Changed paths:
    M llvm/include/llvm/Analysis/ScalarEvolution.h
    M llvm/lib/Analysis/ScalarEvolution.cpp
    M llvm/test/Analysis/ScalarEvolution/finite-trip-count.ll
    M llvm/test/Transforms/IndVarSimplify/pr60944.ll
    M llvm/test/Transforms/IndVarSimplify/range-iter-threshold.ll
    M llvm/test/Transforms/IndVarSimplify/rewrite-loop-exit-value.ll

  Log Message:
  -----------
  [SCEV] Fix finite loop non-strict predicate simplification (PR60944)

There are a number of issues with the current code for converting
ule -> ult (etc) predicates for comparisons controlling finite loops:

* It sets nowrap flags, which may only hold for that particular
  comparison, not globally. (PR60944)
* It doesn't check that the RHS is invariant. (I'm not sure this
  can cause practical issues independently of the previous point.)
* It runs before simplifications that may be more profitable. (PR54191)

This patch moves the handling for this into computeExitLimitFromICmp(),
because it is somewhat tightly coupled with assumptions in that code,
and addresses the aforementioned issues.

Fixes https://github.com/llvm/llvm-project/issues/60944.
Fixes https://github.com/llvm/llvm-project/issues/54191.

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




More information about the All-commits mailing list