1; RUN: opt -globals-aa -gvn -S < %s | FileCheck %s
2
3target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
4target triple = "x86_64-unknown-linux-gnu"
5
6@deallocCalled = internal global i8 0, align 1
7
8; CHECK-LABEL: @main()
9define dso_local i32 @main() {
10entry:
11  %tmp0 = call i8* @llvm.objc.autoreleasePoolPush() #1
12  %tmp6 = load i8, i8* @deallocCalled, align 1
13  %tobool = icmp ne i8 %tmp6, 0
14  br i1 %tobool, label %if.else, label %if.end
15
16if.else:                                          ; preds = %entry
17  call void @__assert_fail() #0
18  unreachable
19
20; CHECK-LABEL: if.end:
21; CHECK-NEXT: call void @llvm.objc.autoreleasePoolPop
22; CHECK-NOT: load i8, i8* @deallocCalled
23if.end:                                           ; preds = %entry
24  call void @llvm.objc.autoreleasePoolPop(i8* %tmp0)
25  %tmp7 = load i8, i8* @deallocCalled, align 1
26  %tobool3 = icmp ne i8 %tmp7, 0
27  br i1 %tobool3, label %if.end6, label %if.else5
28
29if.else5:                                         ; preds = %if.end
30  call void @__assert_fail() #0
31  unreachable
32
33if.end6:                                          ; preds = %if.end
34  store i8 0, i8* @deallocCalled, align 1
35  ret i32 0
36}
37
38declare i8* @llvm.objc.autoreleasePoolPush() #1
39declare void @llvm.objc.autoreleasePoolPop(i8*) #1
40declare dso_local void @__assert_fail() #0
41
42attributes #0 = { noreturn nounwind }
43attributes #1 = { nounwind }
44
45