Revert r247278 "Disable support for modulo expressions"

  This reverts commit 00c5b6ca8832439193036aadaaaee92a43236219.

  We can handle modulo expressions in the domain again.

llvm-svn: 247542
diff --git a/polly/lib/Support/SCEVValidator.cpp b/polly/lib/Support/SCEVValidator.cpp
index 4514219..85bda18 100644
--- a/polly/lib/Support/SCEVValidator.cpp
+++ b/polly/lib/Support/SCEVValidator.cpp
@@ -350,23 +350,17 @@
   }
 
   ValidatorResult visitSRemInstruction(Instruction *SRem, const SCEV *S) {
-    // TODO: FIXME: SRem instructions in the domain description are currently
-    //              not compatible with the domain generation. Once this is
-    //              fixed we need to enable this handling again.
-    return ValidatorResult(SCEVType::INVALID);
-#if 0
-        assert(SRem->getOpcode() == Instruction::SRem &&
-               "Assumed SRem instruction!");
+    assert(SRem->getOpcode() == Instruction::SRem &&
+           "Assumed SRem instruction!");
 
-        auto *Divisor = SRem->getOperand(1);
-        auto *CI = dyn_cast<ConstantInt>(Divisor);
-        if (!CI)
-          return visitGenericInst(SRem, S);
+    auto *Divisor = SRem->getOperand(1);
+    auto *CI = dyn_cast<ConstantInt>(Divisor);
+    if (!CI)
+      return visitGenericInst(SRem, S);
 
-        auto *Dividend = SRem->getOperand(0);
-        auto *DividendSCEV = SE.getSCEV(Dividend);
-        return visit(DividendSCEV);
-#endif
+    auto *Dividend = SRem->getOperand(0);
+    auto *DividendSCEV = SE.getSCEV(Dividend);
+    return visit(DividendSCEV);
   }
 
   ValidatorResult visitUnknown(const SCEVUnknown *Expr) {
diff --git a/polly/test/Isl/CodeGen/if-conditions-in-vector-code.ll b/polly/test/Isl/CodeGen/if-conditions-in-vector-code.ll
index 2a29eaa..6d1bc4b 100644
--- a/polly/test/Isl/CodeGen/if-conditions-in-vector-code.ll
+++ b/polly/test/Isl/CodeGen/if-conditions-in-vector-code.ll
@@ -4,12 +4,6 @@
 ; RUN: opt %loadPolly -polly-detect-unprofitable -polly-codegen -polly-vectorizer=polly -S < %s | \
 ; RUN:     FileCheck %s
 ;
-; TODO: The new domain generation cannot handle modulo domain constraints,
-;       hence modulo handling has been disabled completely. Once this is
-;       resolved this test should work again. Until then we approximate the
-;       whole loop body.
-; XFAIL: *
-
 ;    void foo(float *A) {
 ;      for (long i = 0; i < 16; i++) {
 ;        if (i % 2)
@@ -23,10 +17,10 @@
 
 ; AST: #pragma simd
 ; AST: #pragma known-parallel
-; AST: for (int c0 = 0; c0 <= 16; c0 += 1) {
+; AST: for (int c0 = 0; c0 <= 15; c0 += 1) {
 ; AST:   if ((c0 - 1) % 2 == 0)
 ; AST:     Stmt_bb4(c0);
-; AST:   if (c0 <= 15 && c0 % 3 >= 1)
+; AST:   if (c0 % 3 >= 1)
 ; AST:     Stmt_bb11(c0);
 ; AST: }
 
diff --git a/polly/test/Isl/CodeGen/inner_scev_sdiv_in_rtc.ll b/polly/test/Isl/CodeGen/inner_scev_sdiv_in_rtc.ll
index c6c66e1..5966249 100644
--- a/polly/test/Isl/CodeGen/inner_scev_sdiv_in_rtc.ll
+++ b/polly/test/Isl/CodeGen/inner_scev_sdiv_in_rtc.ll
@@ -1,11 +1,6 @@
 ; RUN: opt %loadPolly -polly-codegen -polly-no-early-exit \
 ; RUN:     -polly-detect-unprofitable -S < %s | FileCheck %s
 ;
-; TODO: The new domain generation cannot handle modulo domain constraints,
-;       hence modulo handling has been disabled completely. Once this is
-;       resolved this test should work again.
-; XFAIL: *
-;
 ; This will just check that we generate valid code here.
 ;
 ; CHECK: polly.start:
diff --git a/polly/test/Isl/CodeGen/srem-in-other-bb.ll b/polly/test/Isl/CodeGen/srem-in-other-bb.ll
index d98abde..9d181be 100644
--- a/polly/test/Isl/CodeGen/srem-in-other-bb.ll
+++ b/polly/test/Isl/CodeGen/srem-in-other-bb.ll
@@ -1,11 +1,6 @@
 ; RUN: opt %loadPolly -polly-codegen -S -polly-no-early-exit \
 ; RUN:     -polly-detect-unprofitable < %s | FileCheck %s
 ;
-; TODO: The new domain generation cannot handle modulo domain constraints,
-;       hence modulo handling has been disabled completely. Once this is
-;       resolved this test should work again.
-; XFAIL: *
-;
 ;    void pos(float *A, long n) {
 ;      for (long i = 0; i < 100; i++)
 ;        A[n % 42] += 1;
diff --git a/polly/test/ScopInfo/NonAffine/modulo_backedge.ll b/polly/test/ScopInfo/NonAffine/modulo_backedge.ll
index 3d35c21..41c3e25 100644
--- a/polly/test/ScopInfo/NonAffine/modulo_backedge.ll
+++ b/polly/test/ScopInfo/NonAffine/modulo_backedge.ll
@@ -1,9 +1,7 @@
 ; RUN: opt %loadPolly -polly-scops -polly-detect-unprofitable -analyze < %s | FileCheck %s
 ;
-; TODO: The new domain generation cannot handle modulo domain constraints,
-;       hence modulo handling has been disabled completely. Once this is
-;       resolved this test should work again.
-; CHECK-NOT: Access
+; CHECK: Domain :=
+; CHECK:   { Stmt_for_body[i0] : i0 <= 6 and i0 >= 0 };
 ;
 ;    void foo(float *A) {
 ;      for (long i = 1;; i++) {
diff --git a/polly/test/ScopInfo/NonAffine/modulo_domain.ll b/polly/test/ScopInfo/NonAffine/modulo_domain.ll
index 61388e4..cbf573e 100644
--- a/polly/test/ScopInfo/NonAffine/modulo_domain.ll
+++ b/polly/test/ScopInfo/NonAffine/modulo_domain.ll
@@ -6,8 +6,7 @@
 ;       whole loop body.
 ;
 ; CHECK:   Domain :=
-; CHECK:       { Stmt_for_body__TO__if_end[i0] : i0 <= 15 and i0 >= 0 };
-;
+; CHECK:       { Stmt_for_body[i0] : i0 <= 15 and i0 >= 0 };
 ;
 ;    void foo(float *A) {
 ;      for (long i = 0; i < 16; i++) {
diff --git a/polly/test/ScopInfo/NonAffine/non_affine_but_srem.ll b/polly/test/ScopInfo/NonAffine/non_affine_but_srem.ll
index d5aaaf0..17fe4da 100644
--- a/polly/test/ScopInfo/NonAffine/non_affine_but_srem.ll
+++ b/polly/test/ScopInfo/NonAffine/non_affine_but_srem.ll
@@ -1,11 +1,6 @@
 ; RUN: opt %loadPolly -polly-scops -polly-detect-unprofitable \
 ; RUN:                -analyze < %s | FileCheck %s
 ;
-; TODO: The new domain generation cannot handle modulo domain constraints,
-;       hence modulo handling has been disabled completely. Once this is
-;       resolved this test should work again.
-; XFAIL: *
-;
 ;    void pos(float *A, long n) {
 ;      for (long i = 0; i < 100; i++)
 ;        A[n % 42] += 1;
diff --git a/polly/test/ScopInfo/multidim_srem.ll b/polly/test/ScopInfo/multidim_srem.ll
index 500ae6e..3be1cef 100644
--- a/polly/test/ScopInfo/multidim_srem.ll
+++ b/polly/test/ScopInfo/multidim_srem.ll
@@ -1,10 +1,5 @@
 ; RUN: opt %loadPolly -analyze -polly-scops -S < %s | FileCheck %s
 ;
-; TODO: The new domain generation cannot handle modulo domain constraints,
-;       hence modulo handling has been disabled completely. Once this is
-;       resolved this test should work again.
-; XFAIL: *
-;
 ;    void foo(long n, float A[][n][n]) {
 ;      for (long i = 0; i < 200; i++)
 ;        for (long j = 0; j < n; j++)
diff --git a/polly/test/ScopInfo/reduction_alternating_base.ll b/polly/test/ScopInfo/reduction_alternating_base.ll
index ca23ff8..8d490e5 100644
--- a/polly/test/ScopInfo/reduction_alternating_base.ll
+++ b/polly/test/ScopInfo/reduction_alternating_base.ll
@@ -1,9 +1,5 @@
 ; RUN: opt %loadPolly -polly-detect-unprofitable -polly-scops -analyze < %s | FileCheck %s
 ;
-; TODO: The new domain generation cannot handle modulo domain constraints,
-;       hence modulo handling has been disabled completely. Once this is
-;       resolved this test should work again.
-; XFAIL: *
 ;
 ;    void f(int *A) {
 ;      for (int i = 0; i < 1024; i++)