[PATCH] D92808: [ObjC][ARC] Use operand bundle 'clang.arc.attachedcall' instead of explicitly emitting retainRV or claimRV calls in the IR

2021-03-04 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment.

Thanks! Reapplied the patch in 
https://github.com/llvm/llvm-project/commit/1900503595cbb84a4c6e140a9ba1a2c574c0586d


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92808/new/

https://reviews.llvm.org/D92808

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D92808: [ObjC][ARC] Use operand bundle 'clang.arc.attachedcall' instead of explicitly emitting retainRV or claimRV calls in the IR

2021-03-04 Thread Florian Hahn via Phabricator via cfe-commits
fhahn added a comment.

In D92808#2602687 , @hans wrote:

> In D92808#2601408 , @fhahn wrote:
>
>> In D92808#2600245 , @hans wrote:
>>
>>> Reverted in 
>>> https://github.com/llvm/llvm-project/commit/0a5dd067181dac2a8882a139ea3bd19bdea5fa44
>>>  until this can be fixed.
>>
>> Thanks! I pushed a fix for the issue in 75805dce5ff8 
>> . 
>> @Hans, would it be possible to check if D92808 
>>  + 75805dce5ff8 
>>  fixes 
>> the issue or should we just recommit D92808 
>> ?
>
> Yes, I confirmed that 75805dce5ff8 
>  fixes 
> the test case I was looking at. Thanks!

Thanks for confirming!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92808/new/

https://reviews.llvm.org/D92808

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D92808: [ObjC][ARC] Use operand bundle 'clang.arc.attachedcall' instead of explicitly emitting retainRV or claimRV calls in the IR

2021-03-04 Thread Hans Wennborg via Phabricator via cfe-commits
hans added a comment.

In D92808#2601408 , @fhahn wrote:

> In D92808#2600245 , @hans wrote:
>
>> Reverted in 
>> https://github.com/llvm/llvm-project/commit/0a5dd067181dac2a8882a139ea3bd19bdea5fa44
>>  until this can be fixed.
>
> Thanks! I pushed a fix for the issue in 75805dce5ff8 
> . @Hans, 
> would it be possible to check if D92808  + 
> 75805dce5ff8 
>  fixes 
> the issue or should we just recommit D92808 ?

Yes, I confirmed that 75805dce5ff8 
 fixes the 
test case I was looking at. Thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92808/new/

https://reviews.llvm.org/D92808

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D92808: [ObjC][ARC] Use operand bundle 'clang.arc.attachedcall' instead of explicitly emitting retainRV or claimRV calls in the IR

2021-03-03 Thread Florian Hahn via Phabricator via cfe-commits
fhahn added a comment.

In D92808#2600245 , @hans wrote:

> Reverted in 
> https://github.com/llvm/llvm-project/commit/0a5dd067181dac2a8882a139ea3bd19bdea5fa44
>  until this can be fixed.

Thanks! I pushed a fix for the issue in 75805dce5ff8 
. @Hans, 
would it be possible to check if D92808  + 
75805dce5ff8 
 fixes the 
issue or should we just recommit D92808 ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92808/new/

https://reviews.llvm.org/D92808

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D92808: [ObjC][ARC] Use operand bundle 'clang.arc.attachedcall' instead of explicitly emitting retainRV or claimRV calls in the IR

2021-03-03 Thread Hans Wennborg via Phabricator via cfe-commits
hans added a comment.

Reverted in 
https://github.com/llvm/llvm-project/commit/0a5dd067181dac2a8882a139ea3bd19bdea5fa44
 until this can be fixed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92808/new/

https://reviews.llvm.org/D92808

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D92808: [ObjC][ARC] Use operand bundle 'clang.arc.attachedcall' instead of explicitly emitting retainRV or claimRV calls in the IR

2021-03-03 Thread Hans Wennborg via Phabricator via cfe-commits
hans added a comment.

The preprocessed source is attached to this comment: 
https://bugs.chromium.org/p/chromium/issues/detail?id=1182642#c26

good.s and bad.s are here: 
https://bugs.chromium.org/p/chromium/issues/detail?id=1182642#c28

And this shows the problematic difference between them: 
https://bugs.chromium.org/p/chromium/issues/detail?id=1182642#c30

After this change, for some reason x0 is getting clobbered in the prologue.

In https://bugs.chromium.org/p/chromium/issues/detail?id=1182642#c31 I verify 
that manually changing the register back to x1 fixes the issue.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92808/new/

https://reviews.llvm.org/D92808

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D92808: [ObjC][ARC] Use operand bundle 'clang.arc.attachedcall' instead of explicitly emitting retainRV or claimRV calls in the IR

2021-03-03 Thread Florian Hahn via Phabricator via cfe-commits
fhahn added a comment.

In D92808#2600031 , @thakis wrote:

>> Thank you. Let me know when you have more information.
>
> Repro is moving along. 
> https://bugs.chromium.org/p/chromium/issues/detail?id=1182642#c26 and onward 
> are getting pretty close.

That's interesting, thanks for sharing! I had a look at the linked good.s/bad.s 
and the sequence mentioned in the comments looks unexpected. `mov   x29, 
x29` should be exactly between a regular call and 
`_objc_retainAutoreleasedReturnValue`, but this is not what's happening in this 
case. I could not find a link to download the (pre-processed) source file. 
Would it be possible to get that file?

  Ltmp239:
bl  _objc_msgSend
  Ltmp705:
mov x29, x29
  Ltmp240:
b   LBB19_3
  LBB19_3:; %invoke.cont4
.loc149 0 9 ; 
../../ios/chrome/browser/ui/infobars/infobar_container_coordinator.mm:0:9
bl  _objc_retainAutoreleasedReturnValue


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92808/new/

https://reviews.llvm.org/D92808

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D92808: [ObjC][ARC] Use operand bundle 'clang.arc.attachedcall' instead of explicitly emitting retainRV or claimRV calls in the IR

2021-03-03 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

> Thank you. Let me know when you have more information.

Repro is moving along. 
https://bugs.chromium.org/p/chromium/issues/detail?id=1182642#c26 and onward 
are getting pretty close.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92808/new/

https://reviews.llvm.org/D92808

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D92808: [ObjC][ARC] Use operand bundle 'clang.arc.attachedcall' instead of explicitly emitting retainRV or claimRV calls in the IR

2021-03-02 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added a comment.

In D92808#2593331 , @ahatanak wrote:

> In D92808#2593204 , @thakis wrote:
>
>> FYI, we're seeing test failures caused by this patch in iOS/arm64 builds 
>> when arc is used (simulator is fine though): 
>> https://bugs.chromium.org/p/chromium/issues/detail?id=1182642#c11
>>
>> We'll try to investigate a bit more on our side, but I wanted to give an 
>> early(ish) heads-up in case others see this or whatnot.
>>
>> Not sure if this landed before or after the 12.0 branch.
>
> Thank you. Let me know when you have more information.
>
> This isn't in release/12.x. The older version of the patch, which used 
> attributes instead of operand bundles, was in release/12.x, but got reverted 
> later.

Just to confirm, the revert is also in release/12.x, so I don't think there's 
any branch concerns here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92808/new/

https://reviews.llvm.org/D92808

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D92808: [ObjC][ARC] Use operand bundle 'clang.arc.attachedcall' instead of explicitly emitting retainRV or claimRV calls in the IR

2021-02-28 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment.

In D92808#2593204 , @thakis wrote:

> FYI, we're seeing test failures caused by this patch in iOS/arm64 builds when 
> arc is used (simulator is fine though): 
> https://bugs.chromium.org/p/chromium/issues/detail?id=1182642#c11
>
> We'll try to investigate a bit more on our side, but I wanted to give an 
> early(ish) heads-up in case others see this or whatnot.
>
> Not sure if this landed before or after the 12.0 branch.

Thank you. Let me know when you have more information.

This isn't in release/12.x. The older version of the patch, which used 
attributes instead of operand bundles, was in release/12.x, but got reverted 
later.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92808/new/

https://reviews.llvm.org/D92808

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D92808: [ObjC][ARC] Use operand bundle 'clang.arc.attachedcall' instead of explicitly emitting retainRV or claimRV calls in the IR

2021-02-28 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

FYI, we're seeing test failures caused by this patch in iOS/arm64 builds when 
arc is used (simulator is fine though): 
https://bugs.chromium.org/p/chromium/issues/detail?id=1182642#c11

We'll try to investigate a bit more on our side, but I wanted to give an 
early(ish) heads-up in case others see this or whatnot.

Not sure if this landed before or after the 12.0 branch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92808/new/

https://reviews.llvm.org/D92808

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D92808: [ObjC][ARC] Use operand bundle 'clang.arc.attachedcall' instead of explicitly emitting retainRV or claimRV calls in the IR

2021-02-12 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment.

Thanks! I didn't realize it hadn't been fixed in the patch I committed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92808/new/

https://reviews.llvm.org/D92808

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D92808: [ObjC][ARC] Use operand bundle 'clang.arc.attachedcall' instead of explicitly emitting retainRV or claimRV calls in the IR

2021-02-12 Thread James Y Knight via Phabricator via cfe-commits
jyknight added a comment.

> I ended up reverting the changes I made to llvm/lib/IR/AutoUpgrade.cpp as the 
> file was including llvm/Analysis/ObjCARCUtil.h, which was violating layering.

It looks like it was not actually reverted in the version ultimately submitted. 
I've pushed commit 3c06676de14d7dd6dc3d1bf2989c503a2a5d438a 
 which 
reverts the change to llvm/lib/IR/AutoUpgrade.cpp (duplicating the string 
constant).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92808/new/

https://reviews.llvm.org/D92808

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D92808: [ObjC][ARC] Use operand bundle 'clang.arc.attachedcall' instead of explicitly emitting retainRV or claimRV calls in the IR

2021-02-12 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGed4718eccb12: [ObjC][ARC] Use operand bundle 
clang.arc.attachedcall instead of (authored by ahatanak).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92808/new/

https://reviews.llvm.org/D92808

Files:
  clang/lib/CodeGen/CGObjC.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/CodeGenModule.h
  clang/test/CodeGenObjC/arc-rv-attr.m
  clang/test/CodeGenObjC/arc-unsafeclaim.m
  llvm/docs/LangRef.rst
  llvm/include/llvm/Analysis/ObjCARCUtil.h
  llvm/include/llvm/IR/InstrTypes.h
  llvm/include/llvm/IR/Intrinsics.td
  llvm/include/llvm/IR/LLVMContext.h
  llvm/lib/Analysis/ObjCARCInstKind.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/IR/AutoUpgrade.cpp
  llvm/lib/IR/Instructions.cpp
  llvm/lib/IR/LLVMContext.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Transforms/ObjCARC/ARCRuntimeEntryPoints.h
  llvm/lib/Transforms/ObjCARC/ObjCARC.cpp
  llvm/lib/Transforms/ObjCARC/ObjCARC.h
  llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp
  llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp
  llvm/lib/Transforms/ObjCARC/PtrState.cpp
  llvm/lib/Transforms/ObjCARC/PtrState.h
  llvm/lib/Transforms/Scalar/SCCP.cpp
  llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
  llvm/lib/Transforms/Utils/InlineFunction.cpp
  llvm/test/Bitcode/operand-bundles-bc-analyzer.ll
  llvm/test/CodeGen/AArch64/call-rv-marker.ll
  llvm/test/Transforms/DeadArgElim/deadretval.ll
  llvm/test/Transforms/Inline/inline-retainRV-call.ll
  llvm/test/Transforms/ObjCARC/contract-marker-funclet.ll
  llvm/test/Transforms/ObjCARC/contract-rv-attr.ll
  llvm/test/Transforms/ObjCARC/contract.ll
  llvm/test/Transforms/ObjCARC/intrinsic-use.ll
  llvm/test/Transforms/ObjCARC/rv.ll
  llvm/test/Transforms/SCCP/clang-arc-rv.ll
  llvm/test/Transforms/TailCallElim/deopt-bundle.ll
  llvm/test/Verifier/operand-bundles.ll

Index: llvm/test/Verifier/operand-bundles.ll
===
--- llvm/test/Verifier/operand-bundles.ll
+++ llvm/test/Verifier/operand-bundles.ll
@@ -1,10 +1,13 @@
 ; RUN: not opt -verify < %s 2>&1 | FileCheck %s
 
+%0 = type opaque
+declare void @g()
+declare %0* @foo0()
+declare i8 @foo1()
+
 ; Operand bundles uses are like regular uses, and need to be dominated
 ; by their defs.
 
-declare void @g()
-
 define void @f0(i32* %ptr) {
 ; CHECK: Instruction does not dominate all uses!
 ; CHECK-NEXT:  %x = add i32 42, 1
@@ -60,3 +63,15 @@
   %x = add i32 42, 1
   ret void
 }
+
+define void @f_clang_arc_attachedcall() {
+; CHECK: Multiple "clang.arc.attachedcall" operand bundles
+; CHECK-NEXT: call %0* @foo0() [ "clang.arc.attachedcall"(i64 0), "clang.arc.attachedcall"(i64 0) ]
+; CHECK-NEXT: must call a function returning a pointer
+; CHECK-NEXT: call i8 @foo1() [ "clang.arc.attachedcall"(i64 0) ]
+
+  call %0* @foo0() [ "clang.arc.attachedcall"(i64 0) ]
+  call %0* @foo0() [ "clang.arc.attachedcall"(i64 0), "clang.arc.attachedcall"(i64 0) ]
+  call i8 @foo1() [ "clang.arc.attachedcall"(i64 0) ]
+  ret void
+}
Index: llvm/test/Transforms/TailCallElim/deopt-bundle.ll
===
--- llvm/test/Transforms/TailCallElim/deopt-bundle.ll
+++ llvm/test/Transforms/TailCallElim/deopt-bundle.ll
@@ -55,3 +55,13 @@
 exit:
   ret void
 }
+
+; CHECK-LABEL: @test_clang_arc_attachedcall(
+; CHECK: tail call i8* @getObj(
+
+declare i8* @getObj()
+
+define i8* @test_clang_arc_attachedcall() {
+  %r = call i8* @getObj() [ "clang.arc.attachedcall"(i64 0) ]
+  ret i8* %r
+}
Index: llvm/test/Transforms/SCCP/clang-arc-rv.ll
===
--- /dev/null
+++ llvm/test/Transforms/SCCP/clang-arc-rv.ll
@@ -0,0 +1,24 @@
+; RUN: opt < %s -ipsccp -S | FileCheck %s
+; Return value can't be zapped if there is a call that has operand bundle
+; "clang.arc.attachedcall".
+
+@g0 = global i8 zeroinitializer, align 1
+
+; CHECK-LABEL: @foo(
+; CHECK: ret i8* @g0
+
+define internal i8* @foo() {
+  ret i8* @g0
+}
+
+; CHECK-LABEL: @test(
+; CHECK: %[[R:.*]] = call i8* @foo()
+; CHECK call void (...) @llvm.objc.clang.arc.noop.use(i8* %[[R]])
+
+define void @test() {
+  %r = call i8* @foo() [ "clang.arc.attachedcall"(i64 1) ]
+  call void (...) @llvm.objc.clang.arc.noop.use(i8* %r)
+  ret void
+}
+
+declare void @llvm.objc.clang.arc.noop.use(...)
Index: llvm/test/Transforms/ObjCARC/rv.ll
===
--- llvm/test/Transforms/ObjCARC/rv.ll
+++ llvm/test/Transforms/ObjCARC/rv.ll
@@ -11,6 +11,7 @@
 declare void @llvm.objc.autoreleasePoolPop(i8*)
 declare void @llvm.objc.autoreleasePoolPush()
 declare i8* @llvm.objc.retainBlock(i8*)
+declare void @llvm.objc.clang.arc.noop.use(...)
 
 

[PATCH] D92808: [ObjC][ARC] Use operand bundle 'clang.arc.attachedcall' instead of explicitly emitting retainRV or claimRV calls in the IR

2021-02-11 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 323218.
ahatanak retitled this revision from "[ObjC][ARC] Use operand bundle 
'clang.arc.rv' instead of explicitly emitting retainRV or claimRV calls in the 
IR" to "[ObjC][ARC] Use operand bundle 'clang.arc.attachedcall' instead of 
explicitly emitting retainRV or claimRV calls in the IR".
ahatanak edited the summary of this revision.
ahatanak added a comment.

- Renamed the operand bundle name to `clang.arc.attachedcall`. I also tried to 
pass the address of the ARC function as the argument, but the verifier doesn't 
allow taking addresses of intrinsics.

- Removed the call to `@llvm.objc.clang.arc.noop.use`, which in some cases was 
preventing the inliner to attach the operand bundle to a call in the callee 
function, when the operand bundle is removed from a call (see 
`BundledRetainClaimRVs::eraseInst`).

- Make sure `emitOptimizedARCReturnCall` doesn't drop any existing operand 
bundle on a call when adding the new operand bundle to the call.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92808/new/

https://reviews.llvm.org/D92808

Files:
  clang/lib/CodeGen/CGObjC.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/CodeGenModule.h
  clang/test/CodeGenObjC/arc-rv-attr.m
  clang/test/CodeGenObjC/arc-unsafeclaim.m
  llvm/docs/LangRef.rst
  llvm/include/llvm/Analysis/ObjCARCUtil.h
  llvm/include/llvm/IR/InstrTypes.h
  llvm/include/llvm/IR/Intrinsics.td
  llvm/include/llvm/IR/LLVMContext.h
  llvm/lib/Analysis/ObjCARCInstKind.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/IR/AutoUpgrade.cpp
  llvm/lib/IR/Instructions.cpp
  llvm/lib/IR/LLVMContext.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Transforms/ObjCARC/ARCRuntimeEntryPoints.h
  llvm/lib/Transforms/ObjCARC/ObjCARC.cpp
  llvm/lib/Transforms/ObjCARC/ObjCARC.h
  llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp
  llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp
  llvm/lib/Transforms/ObjCARC/PtrState.cpp
  llvm/lib/Transforms/ObjCARC/PtrState.h
  llvm/lib/Transforms/Scalar/SCCP.cpp
  llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
  llvm/lib/Transforms/Utils/InlineFunction.cpp
  llvm/test/Bitcode/operand-bundles-bc-analyzer.ll
  llvm/test/CodeGen/AArch64/call-rv-marker.ll
  llvm/test/Transforms/DeadArgElim/deadretval.ll
  llvm/test/Transforms/Inline/inline-retainRV-call.ll
  llvm/test/Transforms/ObjCARC/contract-marker-funclet.ll
  llvm/test/Transforms/ObjCARC/contract-rv-attr.ll
  llvm/test/Transforms/ObjCARC/contract.ll
  llvm/test/Transforms/ObjCARC/intrinsic-use.ll
  llvm/test/Transforms/ObjCARC/rv.ll
  llvm/test/Transforms/SCCP/clang-arc-rv.ll
  llvm/test/Transforms/TailCallElim/deopt-bundle.ll
  llvm/test/Verifier/operand-bundles.ll

Index: llvm/test/Verifier/operand-bundles.ll
===
--- llvm/test/Verifier/operand-bundles.ll
+++ llvm/test/Verifier/operand-bundles.ll
@@ -1,10 +1,13 @@
 ; RUN: not opt -verify < %s 2>&1 | FileCheck %s
 
+%0 = type opaque
+declare void @g()
+declare %0* @foo0()
+declare i8 @foo1()
+
 ; Operand bundles uses are like regular uses, and need to be dominated
 ; by their defs.
 
-declare void @g()
-
 define void @f0(i32* %ptr) {
 ; CHECK: Instruction does not dominate all uses!
 ; CHECK-NEXT:  %x = add i32 42, 1
@@ -60,3 +63,15 @@
   %x = add i32 42, 1
   ret void
 }
+
+define void @f_clang_arc_attachedcall() {
+; CHECK: Multiple "clang.arc.attachedcall" operand bundles
+; CHECK-NEXT: call %0* @foo0() [ "clang.arc.attachedcall"(i64 0), "clang.arc.attachedcall"(i64 0) ]
+; CHECK-NEXT: must call a function returning a pointer
+; CHECK-NEXT: call i8 @foo1() [ "clang.arc.attachedcall"(i64 0) ]
+
+  call %0* @foo0() [ "clang.arc.attachedcall"(i64 0) ]
+  call %0* @foo0() [ "clang.arc.attachedcall"(i64 0), "clang.arc.attachedcall"(i64 0) ]
+  call i8 @foo1() [ "clang.arc.attachedcall"(i64 0) ]
+  ret void
+}
Index: llvm/test/Transforms/TailCallElim/deopt-bundle.ll
===
--- llvm/test/Transforms/TailCallElim/deopt-bundle.ll
+++ llvm/test/Transforms/TailCallElim/deopt-bundle.ll
@@ -55,3 +55,13 @@
 exit:
   ret void
 }
+
+; CHECK-LABEL: @test_clang_arc_attachedcall(
+; CHECK: tail call i8* @getObj(
+
+declare i8* @getObj()
+
+define i8* @test_clang_arc_attachedcall() {
+  %r = call i8* @getObj() [ "clang.arc.attachedcall"(i64 0) ]
+  ret i8* %r
+}
Index: llvm/test/Transforms/SCCP/clang-arc-rv.ll
===
--- /dev/null
+++ llvm/test/Transforms/SCCP/clang-arc-rv.ll
@@ -0,0 +1,24 @@
+; RUN: opt < %s -ipsccp -S | FileCheck %s
+; Return value can't be zapped if there is a call that has operand bundle
+; "clang.arc.attachedcall".
+
+@g0 = global i8 zeroinitializer, align 1
+
+; CHECK-LABEL: @foo(
+; CHECK: ret i8* @g0
+
+define internal i8* @foo() {
+