[PATCH] D19266: [SCEV] Improve the run-time checking of the NoWrap predicate

silviu.baranga@arm.com via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 19 08:47:36 PDT 2016


sbaranga created this revision.
sbaranga added a reviewer: sanjoy.
sbaranga added a subscriber: llvm-commits.
Herald added a subscriber: mzolotukhin.

This implements a new method of run-time checking the NoWrap
SCEV predicates, which should be easier to optimize and nicer
for targets that don't correctly handle multiplication/addition
of large integer types (like i128).

If the AddRec is {a,+,b} and the backedge taken count is c,
the idea is to check that |b| * c doesn't have unsigned overflow,
and depending on the sign of b, that:

   a + |b| * c >= a (b >= 0) or
   a - |b| * c <= a (b <= 0)

where the comparisons above are signed or unsigned, depending on
the flag that we're checking.

The advantage of doing this is that we avoid extending to a larger
type and we avoid the multiplication of large types (multiplying
i128 can be expensive).

http://reviews.llvm.org/D19266

Files:
  lib/Analysis/ScalarEvolutionExpander.cpp
  test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19266.54202.patch
Type: text/x-patch
Size: 14575 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160419/aa68ce6d/attachment.bin>


More information about the llvm-commits mailing list