[PATCH] D50167: RFC: [SCEV] Add explicit representations of umin/smin

Keno Fischer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 1 18:06:49 PDT 2018


loladiro created this revision.
loladiro added reviewers: reames, sanjoy.
Herald added a subscriber: javed.absar.

Currently we express umin as `~umax(~x, ~y)`. However, this becomes
a problem for operands in non-integral pointer spaces, because `~x`
is not something we can compute for `x` non-integral. However, since
comparisons are generally still allowed, we are actually able to
express `umin(x, y)` directly as long as we don't try to express is
as a umax. Support this by adding an explicit umin/smin representation
to SCEV. We do this by factoring the existing getUMax/getSMax functions
into a new function that does all four. The previous two functions
were largely identical, except that the SMax variant used `isKnownPredicate`
while the UMax variant used `isKnownViaNonRecursiveReasoning`.

Trying to make the UMax variant also use `isKnownPredicate` yields to
an infinite recursion, while trying to make the `SMax` variant use
`isKnownViaNonRecursiveReasoning` causes
`Transforms/IndVarSimplify/backedge-on-min-max.ll` to fail.

I would appreciate any insight into which predicate is correct here.


Repository:
  rL LLVM

https://reviews.llvm.org/D50167

Files:
  include/llvm/Analysis/ScalarEvolution.h
  include/llvm/Analysis/ScalarEvolutionExpander.h
  include/llvm/Analysis/ScalarEvolutionExpressions.h
  lib/Analysis/ScalarEvolution.cpp
  lib/Analysis/ScalarEvolutionExpander.cpp
  test/Analysis/LoopAccessAnalysis/memcheck-ni.ll
  test/Analysis/LoopAccessAnalysis/reverse-memcheck-bounds.ll
  test/Analysis/ScalarEvolution/2008-07-29-SMinExpr.ll
  test/Analysis/ScalarEvolution/min-max-exprs.ll
  test/Analysis/ScalarEvolution/pr28705.ll
  test/Analysis/ScalarEvolution/predicated-trip-count.ll
  test/Analysis/ScalarEvolution/trip-count14.ll
  test/Analysis/ScalarEvolution/trip-count3.ll
  test/Transforms/IRCE/conjunctive-checks.ll
  test/Transforms/IRCE/decrementing-loop.ll
  test/Transforms/IRCE/multiple-access-no-preloop.ll
  test/Transforms/IRCE/ranges_of_different_types.ll
  test/Transforms/IRCE/rc-negative-bound.ll
  test/Transforms/IRCE/single-access-no-preloop.ll
  test/Transforms/IRCE/single-access-with-preloop.ll
  test/Transforms/IndVarSimplify/eliminate-trunc.ll
  test/Transforms/LoopStrengthReduce/2013-01-14-ReuseCast.ll
  test/Transforms/LoopVectorize/X86/pr35432.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50167.158673.patch
Type: text/x-patch
Size: 77357 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180802/13154354/attachment-0001.bin>


More information about the llvm-commits mailing list