File: empty-block.ll

package info (click to toggle)
swiftlang 6.1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,604 kB
  • sloc: cpp: 9,901,740; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (57 lines) | stat: -rw-r--r-- 1,801 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
; RUN: opt -S -passes=objc-arc < %s | FileCheck %s
; rdar://10210274

%0 = type opaque

declare ptr @llvm.objc.retain(ptr)

declare void @llvm.objc.release(ptr)

declare ptr @llvm.objc.autoreleaseReturnValue(ptr)

; Don't delete the autorelease.

; CHECK-LABEL: define ptr @test0(
; CHECK:   @llvm.objc.retain
; CHECK: .lr.ph:
; CHECK-NOT: @llvm.objc.r
; CHECK: @llvm.objc.autoreleaseReturnValue
; CHECK-NOT: @llvm.objc.
; CHECK: }
define ptr @test0(ptr %buffer) nounwind {
  %1 = tail call ptr @llvm.objc.retain(ptr %buffer) nounwind
  br i1 undef, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph, %0
  br i1 false, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  %2 = tail call ptr @llvm.objc.retain(ptr %buffer) nounwind
  tail call void @llvm.objc.release(ptr %buffer) nounwind, !clang.imprecise_release !0
  %3 = tail call ptr @llvm.objc.autoreleaseReturnValue(ptr %buffer) nounwind
  ret ptr %buffer
}

; Do delete the autorelease, even with the retain in a different block.

; CHECK-LABEL: define ptr @test1(
; CHECK-NOT: @objc
; CHECK: }
define ptr @test1() nounwind {
  %buffer = call ptr @foo()
  %1 = tail call ptr @llvm.objc.retain(ptr %buffer) nounwind
  br i1 undef, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph, %0
  br i1 false, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  %2 = tail call ptr @llvm.objc.retain(ptr %buffer) nounwind
  tail call void @llvm.objc.release(ptr %buffer) nounwind, !clang.imprecise_release !0
  %3 = tail call ptr @llvm.objc.autoreleaseReturnValue(ptr %buffer) nounwind
  ret ptr %buffer
}

declare ptr @foo()

!0 = !{}