• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -S -basicaa -objc-arc -gvn < %s | FileCheck %s
2
3@x = common global i8* null, align 8
4
5declare i8* @objc_retain(i8*)
6
7; GVN should be able to eliminate this redundant load, with ARC-specific
8; alias analysis.
9
10; CHECK: @foo
11; CHECK-NEXT: entry:
12; CHECK-NEXT: %s = load i8** @x
13; CHECK-NOT: load
14; CHECK: ret i8* %s
15define i8* @foo(i32 %n) nounwind {
16entry:
17  %s = load i8** @x
18  %0 = tail call i8* @objc_retain(i8* %s) nounwind
19  %t = load i8** @x
20  ret i8* %s
21}
22