Index: llvm/lib/Transforms/Utils/LoopUtils.cpp =================================================================== --- llvm/lib/Transforms/Utils/LoopUtils.cpp +++ llvm/lib/Transforms/Utils/LoopUtils.cpp @@ -1501,7 +1501,7 @@ // We walk the initial sequence of loops in reverse because we generally want // to visit defs before uses and the worklist is LIFO. - for (Loop *RootL : Loops) { + for (Loop *RootL : reverse(Loops)) { assert(PreOrderLoops.empty() && "Must start with an empty preorder walk."); assert(PreOrderWorklist.empty() && "Must start with an empty preorder walk worklist."); Index: llvm/test/Analysis/LoopNestAnalysis/infinite.ll =================================================================== --- llvm/test/Analysis/LoopNestAnalysis/infinite.ll +++ llvm/test/Analysis/LoopNestAnalysis/infinite.ll @@ -2,9 +2,9 @@ ; Test that the loop nest analysis is able to analyze an infinite loop in a loop nest. define void @test1(i32** %A, i1 %cond) { +; CHECK-LABEL: IsPerfect=true, Depth=1, OutermostLoop: for.infinite, Loops: ( for.infinite ) ; CHECK-LABEL: IsPerfect=true, Depth=1, OutermostLoop: for.inner, Loops: ( for.inner ) ; CHECK-LABEL: IsPerfect=false, Depth=2, OutermostLoop: for.outer, Loops: ( for.outer for.inner ) -; CHECK-LABEL: IsPerfect=true, Depth=1, OutermostLoop: for.infinite, Loops: ( for.infinite ) entry: br label %for.outer Index: llvm/test/CodeGen/AArch64/loop-micro-op-buffer-size-t99.ll =================================================================== --- llvm/test/CodeGen/AArch64/loop-micro-op-buffer-size-t99.ll +++ llvm/test/CodeGen/AArch64/loop-micro-op-buffer-size-t99.ll @@ -3,18 +3,18 @@ target triple = "aarch64-unknown-linux-gnu" -; CHECK: Loop Unroll: F[foo] Loop %loop.header -; CHECK: Loop Size = 18 -; CHECK: Trip Count = 512 -; CHECK: Trip Multiple = 512 -; CHECK: UNROLLING loop %loop.header by 4 with a breakout at trip 0 -; CHECK: Merging: ; CHECK: Loop Unroll: F[foo] Loop %loop.2.header ; CHECK: Loop Size = 19 ; CHECK: Trip Count = 512 ; CHECK: Trip Multiple = 512 ; CHECK: UNROLLING loop %loop.2.header by 4 with a breakout at trip 0 ; CHECK: Merging: +; CHECK: Loop Unroll: F[foo] Loop %loop.header +; CHECK: Loop Size = 18 +; CHECK: Trip Count = 512 +; CHECK: Trip Multiple = 512 +; CHECK: UNROLLING loop %loop.header by 4 with a breakout at trip 0 +; CHECK: Merging: ; CHECK: %counter = phi i32 [ 0, %entry ], [ %inc.3, %loop.inc.3 ] ; CHECK: %val = add nuw nsw i32 %counter, 5 ; CHECK: %val1 = add nuw nsw i32 %counter, 6 Index: llvm/test/Other/loop-pass-ordering.ll =================================================================== --- llvm/test/Other/loop-pass-ordering.ll +++ llvm/test/Other/loop-pass-ordering.ll @@ -8,11 +8,11 @@ ; / \ \ ; loop.0.0 loop.0.1 loop.1.0 ; +; CHECK: Running pass: NoOpLoopPass on Loop at depth 2 containing: %loop.1.0 +; CHECK: Running pass: NoOpLoopPass on Loop at depth 1 containing: %loop.1 ; CHECK: Running pass: NoOpLoopPass on Loop at depth 2 containing: %loop.0.0 ; CHECK: Running pass: NoOpLoopPass on Loop at depth 2 containing: %loop.0.1 ; CHECK: Running pass: NoOpLoopPass on Loop at depth 1 containing: %loop.0 -; CHECK: Running pass: NoOpLoopPass on Loop at depth 2 containing: %loop.1.0 -; CHECK: Running pass: NoOpLoopPass on Loop at depth 1 containing: %loop.1 define void @f() { entry: Index: llvm/test/Transforms/IndVarSimplify/scev-expander-preserve-lcssa.ll =================================================================== --- llvm/test/Transforms/IndVarSimplify/scev-expander-preserve-lcssa.ll +++ llvm/test/Transforms/IndVarSimplify/scev-expander-preserve-lcssa.ll @@ -113,10 +113,13 @@ ; 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: br i1 false, label [[FOR_BODY84]], label [[RETURN_LOOPEXIT]] +; 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: return.loopexit: ; CHECK-NEXT: br label [[RETURN]] ; CHECK: return.loopexit1: Index: llvm/test/Transforms/LoopUnroll/X86/store_cost.ll =================================================================== --- llvm/test/Transforms/LoopUnroll/X86/store_cost.ll +++ llvm/test/Transforms/LoopUnroll/X86/store_cost.ll @@ -3,12 +3,12 @@ target triple = "x86_64-unknown-linux-gnu" -; CHECK: Loop Unroll: F[foo] Loop %loop.header -; CHECK: Loop Size = 25 -; CHECK: UNROLLING loop %loop.header by 2 ; CHECK: Loop Unroll: F[foo] Loop %loop.2.header ; CHECK: Loop Size = 27 ; CHECK-NOT: UNROLLING loop %loop.2.header +; CHECK: Loop Unroll: F[foo] Loop %loop.header +; CHECK: Loop Size = 25 +; CHECK: UNROLLING loop %loop.header by 2 define void @foo(i32 * %out) { entry: Index: llvm/test/Transforms/LoopUnroll/unroll-loop-invalidation.ll =================================================================== --- llvm/test/Transforms/LoopUnroll/unroll-loop-invalidation.ll +++ llvm/test/Transforms/LoopUnroll/unroll-loop-invalidation.ll @@ -27,15 +27,15 @@ ; CHECK-NOT: Invalidating analysis: LoopAccessAnalysis on inner1.header.1 ; CHECK: Starting Loop pass manager run. ; CHECK: Running pass: LoopAccessInfoPrinterPass -; CHECK: Running analysis: LoopAccessAnalysis on Loop at depth 1 containing: %inner1.header +; CHECK: Running analysis: LoopAccessAnalysis on Loop at depth 1 containing: %inner1.header.1 ; CHECK: Loop access info in function 'test': -; CHECK: inner1.header: +; CHECK: inner1.header.1: ; CHECK: Finished Loop pass manager run. ; CHECK: Starting Loop pass manager run. ; CHECK: Running pass: LoopAccessInfoPrinterPass -; CHECK: Running analysis: LoopAccessAnalysis on Loop at depth 1 containing: %inner1.header.1 +; CHECK: Running analysis: LoopAccessAnalysis on Loop at depth 1 containing: %inner1.header ; CHECK: Loop access info in function 'test': -; CHECK: inner1.header.1: +; CHECK: inner1.header: ; CHECK: Finished Loop pass manager run. target triple = "x86_64-unknown-linux-gnu"