[all-commits] [llvm/llvm-project] 551c28: [indvars] Always fallback to truncation if AddRec ...

Philip Reames via All-commits all-commits at lists.llvm.org
Tue Nov 7 07:49:53 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 551c280cfda6892deb4585b2b8bd1753914f1a36
      https://github.com/llvm/llvm-project/commit/551c280cfda6892deb4585b2b8bd1753914f1a36
  Author: Philip Reames <preames at rivosinc.com>
  Date:   2023-11-07 (Tue, 07 Nov 2023)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
    M llvm/test/Transforms/IndVarSimplify/pr55925.ll
    M llvm/test/Transforms/IndVarSimplify/widen-nonnegative-countdown.ll

  Log Message:
  -----------
  [indvars] Always fallback to truncation if AddRec widening fails (#70967)

The current code structure results in cases where if a) we can't clone
the IV user (because it's not in our whitelist) or b) can't prove the
SCEV expressions are identical, we'd sometimes leave both the original
unwiddened IV and the partially widdened IV in code. Instead, just
truncate thw wide IV to the use - same as what we'd do if we couldn't
find an addrec to start with.

Noticed this while playing with changing how we produce addrecs. The
current structure results in a very tight interlock between SCEVs
internal capabilities and indvars code.




More information about the All-commits mailing list