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 3 4@x = common global i8* null, align 8 5 6declare i8* @llvm.objc.retain(i8*) 7declare i32 @llvm.objc.sync.enter(i8*) 8declare i32 @llvm.objc.sync.exit(i8*) 9 10; GVN should be able to eliminate this redundant load, with ARC-specific 11; alias analysis. 12 13; CHECK: define i8* @test0(i32 %n) 14; CHECK-NEXT: entry: 15; CHECK-NEXT: %s = load i8*, i8** @x 16; CHECK-NOT: load 17; CHECK: ret i8* %s 18; CHECK-NEXT: } 19define i8* @test0(i32 %n) nounwind { 20entry: 21 %s = load i8*, i8** @x 22 %0 = tail call i8* @llvm.objc.retain(i8* %s) nounwind 23 %t = load i8*, i8** @x 24 ret i8* %t 25} 26 27; GVN should not be able to eliminate this redundant load, with ARC-specific 28; alias analysis. 29 30; CHECK-LABEL: define i8* @test1( 31; CHECK: load 32; CHECK: load 33; CHECK: ret i8* %t 34; CHECK: } 35define i8* @test1(i32 %n) nounwind { 36entry: 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) 41 ret i8* %t 42} 43