Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add an optimizer-side test case for ARC bug <rdar://13195034>, fixed

in the frontend with @clang.arc.use.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177928 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information...
commit 3800f5748ffdb55d8838eac9300d84276c3dd2c1 1 parent 57d7607
rjmccall rjmccall authored

Showing 1 changed file with 63 additions and 0 deletions. Show diff stats Hide diff stats

  1. +63 0 test/Transforms/ObjCARC/intrinsic-use.ll
63 test/Transforms/ObjCARC/intrinsic-use.ll
... ... @@ -0,0 +1,63 @@
  1 +; RUN: opt -basicaa -objc-arc -S < %s | FileCheck %s
  2 +
  3 +target datalayout = "e-p:64:64:64"
  4 +
  5 +declare i8* @objc_retain(i8*)
  6 +declare i8* @objc_retainAutorelease(i8*)
  7 +declare void @objc_release(i8*)
  8 +declare i8* @objc_autorelease(i8*)
  9 +
  10 +declare void @clang.arc.use(...)
  11 +
  12 +declare void @test0_helper(i8*, i8**)
  13 +
  14 +; Ensure that we honor clang.arc.use as a use and don't miscompile
  15 +; the reduced test case from <rdar://13195034>.
  16 +;
  17 +; FIXME: the fact that we re-order retains w.r.t. @clang.arc.use could
  18 +; be problematic if we get run twice, e.g. under LTO.
  19 +;
  20 +; CHECK: define void @test0(
  21 +; CHECK: @objc_retain(i8* %x)
  22 +; CHECK-NEXT: store i8* %y, i8** %temp0
  23 +; CHECK-NEXT: @objc_retain(i8* %y)
  24 +; CHECK-NEXT: call void @test0_helper
  25 +; CHECK-NEXT: [[VAL1:%.*]] = load i8** %temp0
  26 +; CHECK-NEXT: call void (...)* @clang.arc.use(i8* %y)
  27 +; CHECK-NEXT: @objc_retain(i8* [[VAL1]])
  28 +; CHECK-NEXT: @objc_release(i8* %y)
  29 +; CHECK-NEXT: store i8* [[VAL1]], i8** %temp1
  30 +; CHECK-NEXT: call void @test0_helper
  31 +; CHECK-NEXT: [[VAL2:%.*]] = load i8** %temp1
  32 +; CHECK-NEXT: call void (...)* @clang.arc.use(i8* [[VAL1]])
  33 +; CHECK-NEXT: @objc_retain(i8* [[VAL2]])
  34 +; CHECK-NEXT: @objc_release(i8* [[VAL1]])
  35 +; CHECK-NEXT: @objc_autorelease(i8* %x)
  36 +; CHECK-NEXT: store i8* %x, i8** %out
  37 +; CHECK-NEXT: @objc_release(i8* [[VAL2]])
  38 +; CHECK-NEXT: ret void
  39 +define void @test0(i8** %out, i8* %x, i8* %y) {
  40 +entry:
  41 + %temp0 = alloca i8*, align 8
  42 + %temp1 = alloca i8*, align 8
  43 + %0 = call i8* @objc_retain(i8* %x) nounwind
  44 + %1 = call i8* @objc_retain(i8* %y) nounwind
  45 + store i8* %y, i8** %temp0
  46 + call void @test0_helper(i8* %x, i8** %temp0)
  47 + %val1 = load i8** %temp0
  48 + %2 = call i8* @objc_retain(i8* %val1) nounwind
  49 + call void (...)* @clang.arc.use(i8* %y) nounwind
  50 + call void @objc_release(i8* %y) nounwind
  51 + store i8* %val1, i8** %temp1
  52 + call void @test0_helper(i8* %x, i8** %temp1)
  53 + %val2 = load i8** %temp1
  54 + %3 = call i8* @objc_retain(i8* %val2) nounwind
  55 + call void (...)* @clang.arc.use(i8* %val1) nounwind
  56 + call void @objc_release(i8* %val1) nounwind
  57 + %4 = call i8* @objc_retain(i8* %x) nounwind
  58 + %5 = call i8* @objc_autorelease(i8* %x) nounwind
  59 + store i8* %x, i8** %out
  60 + call void @objc_release(i8* %val2) nounwind
  61 + call void @objc_release(i8* %x) nounwind
  62 + ret void
  63 +}

0 comments on commit 3800f57

Please sign in to comment.
Something went wrong with that request. Please try again.