1 ; RUN: opt -S -basicaa -objc-arc-aa -gvn < %s | FileCheck %s
3 @x = common global i8* null, align 8
5 declare i8* @llvm.objc.retain(i8*)
6 declare i32 @llvm.objc.sync.enter(i8*)
7 declare i32 @llvm.objc.sync.exit(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*, i8** @x
18 define i8* @test0(i32 %n) nounwind {
20 %s = load i8*, i8** @x
21 %0 = tail call i8* @llvm.objc.retain(i8* %s) nounwind
22 %t = load i8*, i8** @x
26 ; GVN should not be able to eliminate this redundant load, with ARC-specific
29 ; CHECK-LABEL: define i8* @test1(
34 define i8* @test1(i32 %n) nounwind {
36 %s = load i8*, i8** @x
37 %0 = call i32 @llvm.objc.sync.enter(i8* %s)
38 %t = load i8*, i8** @x
39 %1 = call i32 @llvm.objc.sync.exit(i8* %s)