[PATCH] D111878: [SCEV] Allow non-overflowing binops when analyzing SCC

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 15 04:23:18 PDT 2021


mkazantsev created this revision.
mkazantsev added reviewers: reames, nikic, lebedev.ri, fhahn, efriedma.
Herald added a subscriber: hiraditya.
mkazantsev requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

First step of Phi SCC processing was proving that the range of phi-translated
set of external inputs is the union of these inputs.

As the 2nd step, we also allow nuw+nsw binary operations to be included into
the SCC. For such SCCs, not only Phi translation, but also arithmetics is possible,
so we cannot just say its range is union of inputs. However, both Phi translation
and nuw+nsw arithmetic operation preserve the following invariant:
"If all external inputs into this SCC were non-negative, the SCC itself is also non-negative".

In practice, it is very useful to prove range of chunked Phis, what is shown in tests.


https://reviews.llvm.org/D111878

Files:
  llvm/include/llvm/Analysis/ScalarEvolution.h
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/test/Analysis/ScalarEvolution/outer_phi.ll
  llvm/test/Analysis/ScalarEvolution/pr49856.ll
  llvm/test/Analysis/ScalarEvolution/shift-recurrences.ll
  llvm/test/Analysis/ScalarEvolution/trivial-phis.ll
  llvm/test/Transforms/IndVarSimplify/outer_phi.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111878.379965.patch
Type: text/x-patch
Size: 21351 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211015/3e6784ea/attachment.bin>


More information about the llvm-commits mailing list