[all-commits] [llvm/llvm-project] a3d1fb: [SCEV] Prove condition invariance via context

Max Kazantsev via All-commits all-commits at lists.llvm.org
Fri Aug 12 00:24:07 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a3d1fb3b59b473e4f262a05f187de6474b7721e7
      https://github.com/llvm/llvm-project/commit/a3d1fb3b59b473e4f262a05f187de6474b7721e7
  Author: Max Kazantsev <mkazantsev at azul.com>
  Date:   2022-08-12 (Fri, 12 Aug 2022)

  Changed paths:
    M llvm/include/llvm/Analysis/ScalarEvolution.h
    M llvm/lib/Analysis/ScalarEvolution.cpp
    M llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
    M llvm/test/Transforms/IndVarSimplify/cycled_phis.ll
    M llvm/test/Transforms/IndVarSimplify/outer_phi.ll

  Log Message:
  -----------
  [SCEV] Prove condition invariance via context

Contextual knowledge may be used to prove invariance of some conditions.
For example, in this case:
```
  ; %len >= 0
  guard(%iv = {start,+,1}<nuw> <s %len)
  guard(%iv = {start,+,1}<nuw> <u %len)
```
the 2nd check always fails if `start` is negative and always passes otherwise.

It looks like there are more opportunities of this kind that are still to be
implemented in the future.

Differential Revision: https://reviews.llvm.org/D129753
Reviewed By: apilipenko




More information about the All-commits mailing list