1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00
llvm-mirror/test/Transforms/ObjCARC/contract-end-of-use-list.ll
Pete Cooper f6c9646a94 Change the objc ARC optimizer to use the new objc.* intrinsics
We're moving ARC optimisation and ARC emission in clang away from runtime methods
and towards intrinsics.  This is the part which actually uses the intrinsics in the ARC
optimizer when both analyzing the existing calls and emitting new ones.

Differential Revision: https://reviews.llvm.org/D55348

Reviewers: ahatanak
llvm-svn: 349534
2018-12-18 20:32:49 +00:00

31 lines
916 B
LLVM

; 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* @llvm.objc.retainAutoreleasedReturnValue(i8* %call)
%retained1 = call i8* @llvm.objc.retain(i8* %call)
%isnull = icmp eq i8* %retained1, null
br i1 %isnull, label %cleanup, label %if.end
if.end:
; CHECK: %retained2 = call i8* @llvm.objc.retain(i8* %retained1)
%retained2 = call i8* @llvm.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* @llvm.objc.retain(i8*)