1 ; RUN: opt -S -indvars -loop-unswitch < %s | FileCheck %s
2 ; RUN: opt -S -indvars -loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa < %s | FileCheck %s
4 target triple = "x86_64-unknown-linux-gnu"
6 define void @test_01() {
8 ; Make sure we don't fail by SCEV's assertion due to incorrect invalidation.
9 ; CHECK-LABEL: @test_01
14 loop: ; preds = %backedge, %entry
15 %p_50.addr.0 = phi i16 [ undef, %entry ], [ %add2699, %backedge ]
16 %idxprom2690 = sext i16 %p_50.addr.0 to i32
17 %arrayidx2691 = getelementptr inbounds [5 x i32], [5 x i32]* undef, i32 0, i32 %idxprom2690
18 %0 = load i32, i32* %arrayidx2691, align 1
19 %tobool2692 = icmp ne i32 %0, 0
22 inner_loop: ; preds = %inner_backedge, %loop
23 br i1 %tobool2692, label %backedge, label %inner_backedge
25 inner_backedge: ; preds = %inner_loop
28 backedge: ; preds = %inner_loop
29 %add2699 = add nsw i16 %p_50.addr.0, 1
30 br i1 false, label %loop, label %exit
32 exit: ; preds = %backedge