[all-commits] [llvm/llvm-project] ca478b: [SCEV] Support ule/sle exit counts via widening (#...

Nikita Popov via All-commits all-commits at lists.llvm.org
Wed May 22 22:54:29 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ca478bc6cc0e5a5ca6c973772d39404571255a84
      https://github.com/llvm/llvm-project/commit/ca478bc6cc0e5a5ca6c973772d39404571255a84
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2024-05-23 (Thu, 23 May 2024)

  Changed paths:
    M llvm/lib/Analysis/ScalarEvolution.cpp
    M llvm/test/Analysis/ScalarEvolution/exit-count-non-strict.ll
    M llvm/test/CodeGen/PowerPC/ctrloop-le.ll
    M llvm/test/Transforms/IndVarSimplify/AArch64/widen-loop-comp.ll

  Log Message:
  -----------
  [SCEV] Support ule/sle exit counts via widening (#92206)

If we have an exit condition of the form IV <= Limit, we will first try
to convert it into IV < Limit+1 or IV-1 < Limit based on range info (in
icmp simplification). If that fails, we try to convert it to IV < Limit
+ 1 based on controlling exits in non-infinite loops.

However, if all else fails, we can still determine the exit count by
rewriting to ext(IV) < ext(Limit) + 1, where the zero/sign extension
ensures that the addition does not overflow.

Proof: https://alive2.llvm.org/ce/z/iR-iYd



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list