mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
9ea770ddbb
The use_iterator redesign in r203364 introduced an increment past the end of a range in -objc-arc-contract. Added an explicit check for the end of the range. <rdar://problem/16333235> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204195 91177308-0d34-0410-b5e6-96231b3b80d8
31 lines
891 B
LLVM
31 lines
891 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* @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*)
|