1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 04:22:57 +02:00
llvm-mirror/test/Transforms/ObjCARC/split-backedge.ll
Duncan P. N. Exon Smith 9c5542c040 IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly.  These
are the matching assembly changes for the metadata/value split in
r223802.

  - Only use the `metadata` type when referencing metadata from a call
    intrinsic -- i.e., only when it's used as a `Value`.

  - Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
    when referencing it from call intrinsics.

So, assembly like this:

    define @foo(i32 %v) {
      call void @llvm.foo(metadata !{i32 %v}, metadata !0)
      call void @llvm.foo(metadata !{i32 7}, metadata !0)
      call void @llvm.foo(metadata !1, metadata !0)
      call void @llvm.foo(metadata !3, metadata !0)
      call void @llvm.foo(metadata !{metadata !3}, metadata !0)
      ret void, !bar !2
    }
    !0 = metadata !{metadata !2}
    !1 = metadata !{i32* @global}
    !2 = metadata !{metadata !3}
    !3 = metadata !{}

turns into this:

    define @foo(i32 %v) {
      call void @llvm.foo(metadata i32 %v, metadata !0)
      call void @llvm.foo(metadata i32 7, metadata !0)
      call void @llvm.foo(metadata i32* @global, metadata !0)
      call void @llvm.foo(metadata !3, metadata !0)
      call void @llvm.foo(metadata !{!3}, metadata !0)
      ret void, !bar !2
    }
    !0 = !{!2}
    !1 = !{i32* @global}
    !2 = !{!3}
    !3 = !{}

I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines).  I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.

This is part of PR21532.

llvm-svn: 224257
2014-12-15 19:07:53 +00:00

51 lines
1.8 KiB
LLVM

; RUN: opt -S -objc-arc < %s | FileCheck %s
; Handle a retain+release pair entirely contained within a split loop backedge.
; rdar://11256239
; CHECK-LABEL: define void @test0(
; CHECK: call i8* @objc_retain(i8* %call) [[NUW:#[0-9]+]]
; CHECK: call i8* @objc_retain(i8* %call) [[NUW]]
; CHECK: call i8* @objc_retain(i8* %cond) [[NUW]]
; CHECK: call void @objc_release(i8* %call) [[NUW]]
; CHECK: call void @objc_release(i8* %call) [[NUW]]
; CHECK: call void @objc_release(i8* %cond) [[NUW]]
define void @test0() {
entry:
br label %while.body
while.body: ; preds = %while.cond
%call = invoke i8* @returner()
to label %invoke.cont unwind label %lpad, !clang.arc.no_objc_arc_exceptions !0
invoke.cont: ; preds = %while.body
%t0 = call i8* @objc_retain(i8* %call) nounwind
%t1 = call i8* @objc_retain(i8* %call) nounwind
%call.i1 = invoke i8* @returner()
to label %invoke.cont1 unwind label %lpad
invoke.cont1: ; preds = %invoke.cont
%cond = select i1 undef, i8* null, i8* %call
%t2 = call i8* @objc_retain(i8* %cond) nounwind
call void @objc_release(i8* %call) nounwind
call void @objc_release(i8* %call) nounwind
call void @use_pointer(i8* %cond)
call void @objc_release(i8* %cond) nounwind
br label %while.body
lpad: ; preds = %invoke.cont, %while.body
%t4 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*)
catch i8* null
ret void
}
declare i8* @returner()
declare i32 @__objc_personality_v0(...)
declare void @objc_release(i8*)
declare i8* @objc_retain(i8*)
declare void @use_pointer(i8*)
!0 = !{}
; CHECK: attributes [[NUW]] = { nounwind }