File: contract-end-of-use-list.ll

package info (click to toggle)
llvm-toolchain-5.0 1:5.0.1-2~bpo9+1
  • links: PTS, VCS
  • area: main
  • in suites: stretch-backports
  • size: 553,688 kB
  • sloc: cpp: 2,878,786; ansic: 584,110; asm: 246,252; python: 124,751; objc: 106,925; sh: 21,542; lisp: 8,628; pascal: 5,885; ml: 5,544; perl: 5,312; makefile: 2,208; cs: 2,022; xml: 686; php: 212; csh: 117
file content (30 lines) | stat: -rw-r--r-- 891 bytes parent folder | download | duplicates (15)
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
; RUN: opt -S < %s -objc-arc-expand -objc-arc-contract | FileCheck %s
; Don't crash.  Reproducer for a use_iterator bug from r203364.
; rdar://problem/16333235
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-darwin13.2.0"

%struct = type { i8*, i8* }

; CHECK-LABEL: @foo() {
define internal i8* @foo() {
entry:
  %call = call i8* @bar()
; CHECK: %retained1 = call i8* @objc_retainAutoreleasedReturnValue(i8* %call)
  %retained1 = call i8* @objc_retain(i8* %call)
  %isnull = icmp eq i8* %retained1, null
  br i1 %isnull, label %cleanup, label %if.end

if.end:
; CHECK: %retained2 = call i8* @objc_retain(i8* %retained1)
  %retained2 = call i8* @objc_retain(i8* %retained1)
  br label %cleanup

cleanup:
  %retval = phi i8* [ %retained2, %if.end ], [ null, %entry ]
  ret i8* %retval
}

declare i8* @bar()

declare extern_weak i8* @objc_retain(i8*)