1 ; RUN: opt -passes='early-cse<memssa>,loop-mssa(loop-rotate,licm,loop-rotate)' -earlycse-debug-hash -S %s -o - | FileCheck %s
2 ; ModuleID = 'bugpoint-reduced-simplified.bc'
3 source_filename = "bugpoint-output-8903f29.bc"
4 target datalayout = "e-m:e-i64:64-n32:64"
5 target triple = "powerpc64le-unknown-linux-gnu"
7 define void @test(i64 %arg.ssa, i64 %arg.nb) local_unnamed_addr {
8 ; Ensure that loop rotation doesn't duplicate the call to
11 ; CHECK: call i1 @llvm.loop.decrement
12 ; CHECK-NOT: call i1 @llvm.loop.decrement
13 ; CHECK: declare i1 @llvm.loop.decrement
15 switch i32 undef, label %BB_8 [
20 BB_1: ; preds = %BB_12, %BB_4
21 %bcount.1.us = phi i64 [ %.810.us, %BB_4 ], [ 0, %BB_12 ]
22 %0 = add i64 %arg.ssa, %bcount.1.us
23 %.568.us = load i32, ptr undef, align 4
24 %.15.i.us = icmp slt i32 0, %.568.us
25 br i1 %.15.i.us, label %BB_3, label %BB_2
28 %.982.us = add nsw i64 %0, 1
32 %1 = add i64 %arg.ssa, %bcount.1.us
34 %3 = call i1 @llvm.loop.decrement.i32(i32 1)
35 br i1 %3, label %BB_4, label %BB_7
38 %.810.us = add nuw nsw i64 %bcount.1.us, 1
41 BB_5: ; preds = %BB_7, %BB_5
42 %lsr.iv20.i116 = phi i64 [ %2, %BB_7 ], [ %lsr.iv.next21.i126, %BB_5 ]
43 %lsr.iv.next21.i126 = add i64 %lsr.iv20.i116, 1
44 br i1 undef, label %BB_5, label %BB_6
52 BB_8: ; preds = %entry
55 BB_9: ; preds = %entry, %entry
58 BB_10: ; preds = %BB_9
61 BB_11: ; preds = %BB_11, %BB_10
62 br i1 undef, label %BB_11, label %BB_12
64 BB_12: ; preds = %BB_11
65 call void @llvm.set.loop.iterations.i64(i64 %arg.nb)
69 ; Function Attrs: nounwind
70 declare void @llvm.set.loop.iterations.i64(i64) #0
72 ; Function Attrs: nounwind
73 declare i1 @llvm.loop.decrement.i32(i32) #0
75 attributes #0 = { nounwind }