From 512a64de6a977891b52b59c765f7775e0c8ad6cf Mon Sep 17 00:00:00 2001 From: Arthur Eubanks Date: Mon, 7 Dec 2020 22:57:37 -0800 Subject: [PATCH] [test] Fix scev-expander-preserve-lcssa.ll under NPM The NPM runs loop passes over loops in forward program order, rather than the legacy loop PM's reverse program order. This seems to produce better results as shown here. I verified that changing the loop order to reverse program order results in the same IR with the NPM. Reviewed By: fhahn Differential Revision: https://reviews.llvm.org/D92817 --- .../Transforms/IndVarSimplify/scev-expander-preserve-lcssa.ll | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/llvm/test/Transforms/IndVarSimplify/scev-expander-preserve-lcssa.ll b/llvm/test/Transforms/IndVarSimplify/scev-expander-preserve-lcssa.ll index d26d3b2..6c275f3 100644 --- a/llvm/test/Transforms/IndVarSimplify/scev-expander-preserve-lcssa.ll +++ b/llvm/test/Transforms/IndVarSimplify/scev-expander-preserve-lcssa.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt -indvars -S -indvars -verify-loop-lcssa %s | FileCheck %s +; RUN: opt -aa-pipeline=basic-aa -passes=indvars,indvars -S -verify-loop-lcssa %s | FileCheck %s ; Make sure SCEVExpander does not crash and introduce unnecessary LCSSA PHI nodes. ; The tests are a collection of cases with crashes when preserving LCSSA PHI @@ -113,13 +113,10 @@ define void @test2(i16 %x) { ; CHECK: for.body84.preheader: ; CHECK-NEXT: br label [[FOR_BODY84:%.*]] ; CHECK: for.body84: -; CHECK-NEXT: [[I_144:%.*]] = phi i32 [ [[INC:%.*]], [[IF_END106:%.*]] ], [ 0, [[FOR_BODY84_PREHEADER]] ] ; CHECK-NEXT: [[C_2:%.*]] = call i1 @cond() -; CHECK-NEXT: br i1 [[C_2]], label [[IF_END106]], label [[RETURN_LOOPEXIT:%.*]] +; CHECK-NEXT: br i1 [[C_2]], label [[IF_END106:%.*]], label [[RETURN_LOOPEXIT:%.*]] ; CHECK: if.end106: -; CHECK-NEXT: [[INC]] = add nuw nsw i32 [[I_144]], 1 -; CHECK-NEXT: [[CMP82:%.*]] = icmp slt i32 [[INC]], [[I_0_LCSSA2]] -; CHECK-NEXT: br i1 [[CMP82]], label [[FOR_BODY84]], label [[RETURN_LOOPEXIT]] +; CHECK-NEXT: br i1 false, label [[FOR_BODY84]], label [[RETURN_LOOPEXIT]] ; CHECK: return.loopexit: ; CHECK-NEXT: br label [[RETURN]] ; CHECK: return.loopexit1: -- 2.7.4