[PATCH] D77775: [LoopLoadElim] Fix crash by always checking simplify form

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 9 19:36:22 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG4e8782302691: [LoopLoadElim] Fix crash by always checking simplify form (authored by mkazantsev).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77775/new/

https://reviews.llvm.org/D77775

Files:
  llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp
  llvm/test/Transforms/LoopLoadElim/new-pm-preheader-problem.ll


Index: llvm/test/Transforms/LoopLoadElim/new-pm-preheader-problem.ll
===================================================================
--- llvm/test/Transforms/LoopLoadElim/new-pm-preheader-problem.ll
+++ llvm/test/Transforms/LoopLoadElim/new-pm-preheader-problem.ll
@@ -1,7 +1,5 @@
-; XFAIL: *
 ; RUN: opt -passes=loop-load-elim -S < %s | FileCheck %s
-; This test demonstrates an assertion failure due to missing preheader in new PM.
-; REQUIRES: asserts
+; Make sure it doesn't crash in new pass manager due to missing preheader.
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 
 define void @test(i32* noalias nocapture %A, i32* noalias nocapture readonly %B, i64 %N, i1 %C) {
Index: llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp
+++ llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp
@@ -535,6 +535,11 @@
       return false;
     }
 
+    if (!L->isLoopSimplifyForm()) {
+      LLVM_DEBUG(dbgs() << "Loop is not is loop-simplify form");
+      return false;
+    }
+
     if (!Checks.empty() || !LAI.getPSE().getUnionPredicate().isAlwaysTrue()) {
       if (LAI.hasConvergentOp()) {
         LLVM_DEBUG(dbgs() << "Versioning is needed but not allowed with "
@@ -554,11 +559,6 @@
         return false;
       }
 
-      if (!L->isLoopSimplifyForm()) {
-        LLVM_DEBUG(dbgs() << "Loop is not is loop-simplify form");
-        return false;
-      }
-
       // Point of no-return, start the transformation.  First, version the loop
       // if necessary.
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77775.256486.patch
Type: text/x-patch
Size: 1611 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200410/6e347a22/attachment.bin>


More information about the llvm-commits mailing list