[PATCH] D33195: [Polly] Add invalidation of the loop SCEVs after merge block generation

Baranidharan Mohan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 15 06:44:54 PDT 2017


mbdharan created this revision.
mbdharan added a project: Polly.

The SCEVs of loops surrounding the escape users of a merge blocks are forgotten, so that loop trip counts based on old values can revoked.

This fixes https://bugs.llvm.org//show_bug.cgi?id=32536


https://reviews.llvm.org/D33195

Files:
  lib/CodeGen/BlockGenerators.cpp


Index: lib/CodeGen/BlockGenerators.cpp
===================================================================
--- lib/CodeGen/BlockGenerators.cpp
+++ lib/CodeGen/BlockGenerators.cpp
@@ -781,6 +781,17 @@
           SE.forgetValue(&Inst);
     else
       llvm_unreachable("Unexpected statement type found");
+  // Invalidate SCEV of loops surrounding EscapeUsers
+  for (const auto &EscapeMapping : EscapeMap) {
+    const EscapeUserVectorTy &EscapeUsers = EscapeMapping.second.second;
+    for (Instruction *EUser : EscapeUsers) {
+      if (Loop *L = LI.getLoopFor(EUser->getParent()))
+        while (L) {
+          SE.forgetLoop(L);
+          L = L->getParentLoop();
+        }
+    }
+  }
 }
 
 void BlockGenerator::finalizeSCoP(Scop &S) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33195.98999.patch
Type: text/x-patch
Size: 743 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170515/fe4982d9/attachment.bin>


More information about the llvm-commits mailing list