[PATCH] D52026: [LoopInterchange] Preserve ScalarEvolution, by forgetting about interchanged loops.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 14 00:52:26 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL342209: [LoopInterchange] Preserve ScalarEvolution, by forgetting about interchanged… (authored by fhahn, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D52026?vs=165257&id=165435#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D52026

Files:
  llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp
  llvm/trunk/test/Transforms/LoopInterchange/interchangeable.ll
  llvm/trunk/test/Transforms/LoopInterchange/phi-ordering.ll


Index: llvm/trunk/test/Transforms/LoopInterchange/phi-ordering.ll
===================================================================
--- llvm/trunk/test/Transforms/LoopInterchange/phi-ordering.ll
+++ llvm/trunk/test/Transforms/LoopInterchange/phi-ordering.ll
@@ -1,5 +1,5 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt < %s -loop-interchange -verify-dom-info -verify-loop-info -S 2>&1 | FileCheck %s
+; RUN: opt < %s -loop-interchange -verify-dom-info -verify-loop-info -verify-scev -S 2>&1 | FileCheck %s
 ;; Checks the order of the inner phi nodes does not cause havoc.
 ;; The inner loop has a reduction into c. The IV is not the first phi.
 
Index: llvm/trunk/test/Transforms/LoopInterchange/interchangeable.ll
===================================================================
--- llvm/trunk/test/Transforms/LoopInterchange/interchangeable.ll
+++ llvm/trunk/test/Transforms/LoopInterchange/interchangeable.ll
@@ -1,5 +1,5 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt < %s -basicaa -loop-interchange -verify-dom-info -verify-loop-info -S | FileCheck %s
+; RUN: opt < %s -basicaa -loop-interchange -verify-dom-info -verify-loop-info -verify-scev -S | FileCheck %s
 
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
Index: llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp
+++ llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp
@@ -454,6 +454,7 @@
 
     AU.addPreserved<DominatorTreeWrapperPass>();
     AU.addPreserved<LoopInfoWrapperPass>();
+    AU.addPreserved<ScalarEvolutionWrapperPass>();
   }
 
   bool runOnFunction(Function &F) override {
@@ -1231,6 +1232,10 @@
   // outer loop.
   NewOuter->addBlockEntry(OrigOuterPreHeader);
   LI->changeLoopFor(OrigOuterPreHeader, NewOuter);
+
+  // Tell SE that we move the loops around.
+  SE->forgetLoop(NewOuter);
+  SE->forgetLoop(NewInner);
 }
 
 bool LoopInterchangeTransform::transform() {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52026.165435.patch
Type: text/x-patch
Size: 2125 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180914/495c3714/attachment.bin>


More information about the llvm-commits mailing list