[PATCH] D11977: Use modulo semantic to generate non-integer-overflow assumptions

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 16 05:49:28 PDT 2015


grosser added a comment.

Hi Johannes,

I found one test case where modulo wrapping happens and where Polly currently, but also with your patch, produces incorrect results:

  void __attribute__ ((noinline)) foo(float *A, long N) {
    for (long i = 0; i < N; i++)
      if ((signed char)i < 100)
        A[i] += i;
  }

F751015: test-wrapping-in-condition.c <http://reviews.llvm.org/F751015>

Compiled with polly-clang test-wrapping-in-condition.c  -O3 -mllvm -polly -mllvm -polly-no-early-exit Polly derives the domain:

> [ N ] -> { Stmt_if_then[i0] : i0 >= 0 and i0 <= -1 + N and N >= 1 and i0 <= 99 };


and only runs the first 99 iterations. Without Polly, we run 1000 iterations, but only for those where "i" casted to char is smaller than 99 the values of A are actually updated.

With your patch the BoundaryContext is empty, Should your patch not have a constraint N <= 128 in the BoundaryContext to prevent this miscompilation?


http://reviews.llvm.org/D11977





More information about the llvm-commits mailing list