[objc-arc] KnownSafe does not imply that it is safe to perform code motion across...
[oota-llvm.git] / test / Transforms / ObjCARC / gvn.ll
1 ; RUN: opt -S -basicaa -objc-arc-aa -gvn < %s | FileCheck %s
2
3 @x = common global i8* null, align 8
4
5 declare i8* @objc_retain(i8*)
6
7 ; GVN should be able to eliminate this redundant load, with ARC-specific
8 ; alias analysis.
9
10 ; CHECK: define i8* @foo(i32 %n)
11 ; CHECK-NEXT: entry:
12 ; CHECK-NEXT: %s = load i8** @x
13 ; CHECK-NOT: load
14 ; CHECK: ret i8* %s
15 ; CHECK-NEXT: }
16 define i8* @foo(i32 %n) nounwind {
17 entry:
18   %s = load i8** @x
19   %0 = tail call i8* @objc_retain(i8* %s) nounwind
20   %t = load i8** @x
21   ret i8* %s
22 }