1 ; RUN: opt -S -basicaa -objc-arc-aa -gvn < %s | FileCheck %s
3 @x = common global i8* null, align 8
5 declare i8* @objc_retain(i8*)
6 declare i32 @objc_sync_start(i8*)
7 declare i32 @objc_sync_stop(i8*)
9 ; GVN should be able to eliminate this redundant load, with ARC-specific
12 ; CHECK: define i8* @test0(i32 %n)
14 ; CHECK-NEXT: %s = load i8** @x
18 define i8* @test0(i32 %n) nounwind {
21 %0 = tail call i8* @objc_retain(i8* %s) nounwind
26 ; CHECK: define i8* @test1(i32 %n)
28 ; CHECK-NEXT: %s = load i8** @x
29 ; CHECK-NEXT: call i32 @objc_sync_start
30 ; CHECK-NEXT: call i32 @objc_sync_stop
31 ; CHECK-NEXT: ret i8* %s
33 define i8* @test1(i32 %n) nounwind {
36 %0 = call i32 @objc_sync_start(i8* %s)
38 %1 = call i32 @objc_sync_stop(i8* %s)