[LoopLoadElim] Fix crash by always checking simplify form

Loop simplify form should always be checked because logic of
propagateStoredValueToLoadUsers relies on it (in particular, it
requires preheader).

Reviewed By: Fedor Sergeev, Florian Hahn
Differential Revision: https://reviews.llvm.org/D77775
This commit is contained in:
Max Kazantsev 2020-04-10 08:48:29 +07:00
parent b647de9925
commit 4e87823026
2 changed files with 6 additions and 8 deletions

View File

@ -535,6 +535,11 @@ public:
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 @@ public:
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.

View File

@ -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) {