Don't analyze block if it's not considered for ifcvt anymore.
[llvm/stm8.git] / test / Transforms / ObjCARC / contract-storestrong.ll
blob50ed260eb08659dd9fa36f16a63a9184826470b8
1 ; RUN: opt -objc-arc-contract -S < %s | FileCheck %s
3 target datalayout = "e-p:64:64:64"
5 declare i8* @objc_retain(i8*)
6 declare void @objc_release(i8*)
8 @x = external global i8*
10 ; CHECK: define void @test0(
11 ; CHECK: entry:
12 ; CHECK-NEXT: call void @objc_storeStrong(i8** @x, i8* %p) nounwind
13 ; CHECK-NEXT: ret void
14 define void @test0(i8* %p) {
15 entry:
16   %0 = tail call i8* @objc_retain(i8* %p) nounwind
17   %tmp = load i8** @x, align 8
18   store i8* %0, i8** @x, align 8
19   tail call void @objc_release(i8* %tmp) nounwind
20   ret void
23 ; Don't do this if the load is volatile.
25 ;      CHECK: define void @test1(i8* %p) {
26 ; CHECK-NEXT: entry:
27 ; CHECK-NEXT:   %0 = tail call i8* @objc_retain(i8* %p) nounwind
28 ; CHECK-NEXT:   %tmp = volatile load i8** @x, align 8
29 ; CHECK-NEXT:   store i8* %0, i8** @x, align 8
30 ; CHECK-NEXT:   tail call void @objc_release(i8* %tmp) nounwind
31 ; CHECK-NEXT:   ret void
32 ; CHECK-NEXT: }
33 define void @test1(i8* %p) {
34 entry:
35   %0 = tail call i8* @objc_retain(i8* %p) nounwind
36   %tmp = volatile load i8** @x, align 8
37   store i8* %0, i8** @x, align 8
38   tail call void @objc_release(i8* %tmp) nounwind
39   ret void
42 ; Don't do this if the store is volatile.
44 ;      CHECK: define void @test2(i8* %p) {
45 ; CHECK-NEXT: entry:
46 ; CHECK-NEXT:   %0 = tail call i8* @objc_retain(i8* %p) nounwind
47 ; CHECK-NEXT:   %tmp = load i8** @x, align 8
48 ; CHECK-NEXT:   volatile store i8* %0, i8** @x, align 8
49 ; CHECK-NEXT:   tail call void @objc_release(i8* %tmp) nounwind
50 ; CHECK-NEXT:   ret void
51 ; CHECK-NEXT: }
52 define void @test2(i8* %p) {
53 entry:
54   %0 = tail call i8* @objc_retain(i8* %p) nounwind
55   %tmp = load i8** @x, align 8
56   volatile store i8* %0, i8** @x, align 8
57   tail call void @objc_release(i8* %tmp) nounwind
58   ret void