[PATCH] D25848: [PM/OptBisect] Don't crash with some particular values of -opt-bisect-limit=

Davide Italiano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 23 05:23:24 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL290427: [LICM] Work around LICM needs to maintain state across loops. (authored by davide).

Changed prior to commit:
  https://reviews.llvm.org/D25848?vs=75365&id=82411#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25848

Files:
  llvm/trunk/lib/Transforms/Scalar/LICM.cpp
  llvm/trunk/test/Transforms/LICM/bisect-state.ll


Index: llvm/trunk/test/Transforms/LICM/bisect-state.ll
===================================================================
--- llvm/trunk/test/Transforms/LICM/bisect-state.ll
+++ llvm/trunk/test/Transforms/LICM/bisect-state.ll
@@ -0,0 +1,15 @@
+; Make sure we don't crash in LICM.
+; RUN: opt %s -licm -opt-bisect-limit=1
+
+define void @patatino() {
+for.cond1:
+  br label %for.body
+for.body:
+  br label %for.cond5
+for.cond5:
+  br i1 true, label %if.end, label %for.end
+if.end:
+  br label %for.cond5
+for.end:
+  br label %for.body
+}
Index: llvm/trunk/lib/Transforms/Scalar/LICM.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/LICM.cpp
+++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp
@@ -124,8 +124,13 @@
   }
 
   bool runOnLoop(Loop *L, LPPassManager &LPM) override {
-    if (skipLoop(L))
+    if (skipLoop(L)) {
+      // If we have run LICM on a previous loop but now we are skipping
+      // (because we've hit the opt-bisect limit), we need to clear the
+      // loop alias information.
+      LICM.getLoopToAliasSetMap().clear();
       return false;
+    }
 
     auto *SE = getAnalysisIfAvailable<ScalarEvolutionWrapperPass>();
     return LICM.runOnLoop(L,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25848.82411.patch
Type: text/x-patch
Size: 1238 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161223/cd38850c/attachment.bin>


More information about the llvm-commits mailing list