[PATCH] D10161: [SCEV][LoopVectorize] Allow ScalarEvolution to make assumptions about overflows

silviu.baranga at arm.com silviu.baranga at arm.com
Thu Jul 16 05:08:33 PDT 2015


sbaranga updated this revision to Diff 29882.
sbaranga added a comment.

Re-designed to allow the users to make only the assumptions that they need.

The new implementation does not need the AssumingScalarEvolution pass.

Added "SCEVPredicate" as a class in SCEV as an interface for an assumption that
can be made and checked at run-time. Currently we only have implementations for
the SCEVAddRec overflow assumptions, and a SCEVPredicate that can hold
multiple other predicates (SCEVPredicateSet).

We use a SCEV rewriter to take a SCEV and transform it according to the
predicates in a predicate set. Combined with the SCEV AddRec overflow
predicate, this allows us to fold sext/zext expressions into AddRec
expressions and will produce folded SCEVs equivalent with what
the AssumingScalarEvolution pass was producing.

Added a SCEVPredicate in ExitLimit, to allow getting a backedge count
guarded by a SCEV predicate and patched the ExitLimit logic to handle the
predicate. Added code to generate SCEV overflow predicates when
computing the loop count from an icmp condition (more code paths could also
theoretically do this).

Added a getGuardedBackedgeCount method to ScalarEvolution that can return
the backedge count as a SCEV guarded by a predicate. Now LoopAccessAnalysis
and LoopVectorize are using this method.

Modified LoopAccessAnalysis and LoopVectorize to use the SCEV rewriter.
These passes were already using something similar for the symbolic stride.

We now also allow LoopDistribute to use generate the SCEV run-time checks.
This allows us to remove special handling in the LoopAccessAnalysis for the
case where a client wasn't aware of the new run-time checks.


http://reviews.llvm.org/D10161

Files:
  include/llvm/Analysis/LoopAccessAnalysis.h
  include/llvm/Analysis/ScalarEvolution.h
  include/llvm/Analysis/ScalarEvolutionExpressions.h
  include/llvm/Transforms/Utils/LoopVersioning.h
  lib/Analysis/LoopAccessAnalysis.cpp
  lib/Analysis/ScalarEvolution.cpp
  lib/Transforms/Scalar/LoopDistribute.cpp
  lib/Transforms/Utils/LoopVersioning.cpp
  lib/Transforms/Vectorize/LoopVectorize.cpp
  test/Transforms/LoopDistribute/distribute-with-overflows.ll
  test/Transforms/LoopVectorize/safegep.ll
  test/Transforms/LoopVectorize/scev-overflow-check.ll
  test/Transforms/LoopVectorize/version-mem-access.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10161.29882.patch
Type: text/x-patch
Size: 90298 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150716/fdafc888/attachment.bin>


More information about the llvm-commits mailing list