1 ; RUN: opt -S -basic-aa -objc-arc-aa -gvn < %s | FileCheck %s
2 ; RUN: opt -S -aa-pipeline=basic-aa,objc-arc-aa -passes=gvn < %s | FileCheck %s
4 @x = common global i8* null, align 8
6 declare i8* @llvm.objc.retain(i8*)
7 declare i32 @llvm.objc.sync.enter(i8*)
8 declare i32 @llvm.objc.sync.exit(i8*)
10 ; GVN should be able to eliminate this redundant load, with ARC-specific
13 ; CHECK: define i8* @test0(i32 %n)
15 ; CHECK-NEXT: %s = load i8*, i8** @x
19 define i8* @test0(i32 %n) nounwind {
21 %s = load i8*, i8** @x
22 %0 = tail call i8* @llvm.objc.retain(i8* %s) nounwind
23 %t = load i8*, i8** @x
27 ; GVN should not be able to eliminate this redundant load, with ARC-specific
30 ; CHECK-LABEL: define i8* @test1(
35 define i8* @test1(i32 %n) nounwind {
37 %s = load i8*, i8** @x
38 %0 = call i32 @llvm.objc.sync.enter(i8* %s)
39 %t = load i8*, i8** @x
40 %1 = call i32 @llvm.objc.sync.exit(i8* %s)