OSDN Git Service

The patch fixes PR27392.
authorEvgeny Stupachenko <evstupac@gmail.com>
Wed, 27 Apr 2016 03:04:54 +0000 (03:04 +0000)
committerEvgeny Stupachenko <evstupac@gmail.com>
Wed, 27 Apr 2016 03:04:54 +0000 (03:04 +0000)
commita27504ef0698b7d495c7aab76f1d6ee1efb07411
tree6eff2728a985673aee6e137aa860721c3a155914
parentee1148650bd140f268e2be4faa68198fbd324964
The patch fixes PR27392.
Summary:
 It is incorrect to compare TripCount (which is BECount + 1)
  with extraiters (or Count) to check if we should enter unrolled
  loop or not, because TripCount can potentially overflow
  (when BECount is max unsigned integer).
 While comparing BECount with (Count - 1) is overflow safe and
  therefore correct.

Reviewer: hfinkel

Differential Revision: http://reviews.llvm.org/D19256

From: Evgeny Stupachenko <evstupac@gmail.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267662 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/LoopUnrollRuntime.cpp
test/Transforms/LoopUnroll/AArch64/runtime-loop.ll
test/Transforms/LoopUnroll/runtime-loop.ll
test/Transforms/LoopUnroll/runtime-loop1.ll
test/Transforms/LoopUnroll/tripcount-overflow.ll