1; RUN: opt -loop-unswitch -enable-new-pm=0 %s -S | FileCheck %s
2
3; When hoisting simple values out from a loop, and not being able to attempt to
4; non-trivally unswitch the loop, due to the optsize attribute, the pass would
5; return an incorrect Modified status. This was caught by the pass return
6; status check that is hidden under EXPENSIVE_CHECKS.
7
8; CHECK-LABEL: entry:
9; CHECK-NEXT: %0 = call i32 @llvm.objectsize.i32.p0i8(i8* bitcast (%struct.anon* @b to i8*), i1 false, i1 false, i1 false)
10; CHECK-NEXT: %1 = icmp uge i32 %0, 1
11; CHECK-NEXT: br label %for.cond
12
13%struct.anon = type { i16 }
14
15@b = global %struct.anon zeroinitializer, align 1
16
17; Function Attrs: minsize nounwind optsize
18define i16 @c() #0 {
19entry:
20  br label %for.cond
21
22for.cond:                                         ; preds = %cont, %entry
23  br label %for.inc
24
25for.inc:                                          ; preds = %for.cond
26  %0 = call i32 @llvm.objectsize.i32.p0i8(i8* bitcast (%struct.anon* @b to i8*), i1 false, i1 false, i1 false)
27  %1 = icmp uge i32 %0, 1
28  br i1 %1, label %cont, label %cont
29
30cont:                                             ; preds = %for.inc
31  %2 = load i16, i16* getelementptr inbounds (%struct.anon, %struct.anon* @b, i32 0, i32 0), align 1
32  br label %for.cond
33}
34
35; Function Attrs: nounwind readnone speculatable willreturn
36declare i32 @llvm.objectsize.i32.p0i8(i8*, i1 immarg, i1 immarg, i1 immarg) #1
37
38attributes #0 = { minsize nounwind optsize }
39attributes #1 = { nounwind readnone speculatable willreturn }
40