1 ; RUN: opt -loop-unswitch -enable-new-pm=0 %s -S | FileCheck %s
3 ; When hoisting simple values out from a loop, and not being able to unswitch
4 ; the loop due to the invoke instruction, the pass would return an incorrect
5 ; Modified status. This was caught by the pass return status check that is
6 ; hidden under EXPENSIVE_CHECKS.
8 ; CHECK-LABEL: for.cond:
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.inc
13 %struct.anon = type { i16 }
15 @b = global %struct.anon zeroinitializer, align 1
17 ; Function Attrs: nounwind
18 define i32 @c() #0 personality i32 (...)* @__CxxFrameHandler3 {
22 for.cond: ; preds = %cont, %entry
25 for.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 %delete.notnull, label %delete.notnull
30 delete.notnull: ; preds = %for.inc
31 invoke void @g() to label %invoke.cont unwind label %lpad
33 invoke.cont: ; preds = %delete.notnull
36 lpad: ; preds = %delete.notnull
37 %cp = cleanuppad within none []
38 cleanupret from %cp unwind to caller
40 cont: ; preds = %for.inc
41 %2 = load i16, i16* getelementptr inbounds (%struct.anon, %struct.anon* @b, i32 0, i32 0), align 1
45 ; Function Attrs: nounwind readnone speculatable willreturn
46 declare i32 @llvm.objectsize.i32.p0i8(i8*, i1 immarg, i1 immarg, i1 immarg) #1
50 declare i32 @__CxxFrameHandler3(...)
52 attributes #0 = { nounwind }
53 attributes #1 = { nounwind readnone speculatable willreturn }