[polly] r288328 - [FIX] Do not try to hoist obviously overwritten loads

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 1 03:10:45 PST 2016


Author: jdoerfert
Date: Thu Dec  1 05:10:45 2016
New Revision: 288328

URL: http://llvm.org/viewvc/llvm-project?rev=288328&view=rev
Log:
[FIX] Do not try to hoist obviously overwritten loads

Modified:
    polly/trunk/lib/Support/ScopHelper.cpp
    polly/trunk/test/ScopInfo/partially_invariant_load_2.ll

Modified: polly/trunk/lib/Support/ScopHelper.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/ScopHelper.cpp?rev=288328&r1=288327&r2=288328&view=diff
==============================================================================
--- polly/trunk/lib/Support/ScopHelper.cpp (original)
+++ polly/trunk/lib/Support/ScopHelper.cpp Thu Dec  1 05:10:45 2016
@@ -454,6 +454,9 @@ bool polly::isHoistableLoad(LoadInst *LI
       continue;
 
     auto &BB = *UserI->getParent();
+    if (DT.dominates(&BB, LInst->getParent()))
+      return false;
+
     bool DominatesAllPredecessors = true;
     for (auto Pred : predecessors(R.getExit()))
       if (R.contains(Pred) && !DT.dominates(&BB, Pred))

Modified: polly/trunk/test/ScopInfo/partially_invariant_load_2.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/partially_invariant_load_2.ll?rev=288328&r1=288327&r2=288328&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/partially_invariant_load_2.ll (original)
+++ polly/trunk/test/ScopInfo/partially_invariant_load_2.ll Thu Dec  1 05:10:45 2016
@@ -3,13 +3,14 @@
 ; Check that we do not try to preload *I and assume p != 42.
 ;
 ; CHECK:      Invariant Accesses: {
-; CHECK-NEXT:   ReadAccess := [Reduction Type: NONE] [Scalar: 0]
-; CHECK-NEXT:   [N, p, tmp1, q] -> { Stmt_if_then[i0] -> MemRef_I[0] };
-; CHECK-NEXT:   Execution Context: [N, p, tmp1, q] -> {  : 1 = 0 }
 ; CHECK-NEXT: }
 ;
 ; CHECK:      Invalid Context:
-; CHECK-NEXT: [N, p, tmp1, q] -> {  : p = 42 and N > 0 }
+; CHECK-NEXT: [N, p] -> {  : 1 = 0 }
+;
+; CHECK:      Stmt_if_then__TO__if_end
+; CHECK-NEXT:   Domain :=
+; CHECK-NEXT:   [N, p] -> { Stmt_if_then__TO__if_end[i0] : p = 42 and 0 <= i0 < N };
 ;
 ;    void f(int *A, int *I, int N, int p, int q) {
 ;      for (int i = 0; i < N; i++) {




More information about the llvm-commits mailing list