[llvm] r178369 - Add clang.arc.used to ModuleHasARC so ARC always runs if said call is present in a module.
Michael Gottesman
mgottesman at apple.com
Fri Mar 29 14:15:24 PDT 2013
Author: mgottesman
Date: Fri Mar 29 16:15:23 2013
New Revision: 178369
URL: http://llvm.org/viewvc/llvm-project?rev=178369&view=rev
Log:
Add clang.arc.used to ModuleHasARC so ARC always runs if said call is present in a module.
clang.arc.used is an interesting call for ARC since ObjCARCContract
needs to run to remove said intrinsic to avoid a linker error (since the
call does not exist).
Added:
llvm/trunk/test/Transforms/ObjCARC/clang-arc-used-intrinsic-removed-if-isolated.ll
Modified:
llvm/trunk/lib/Transforms/ObjCARC/ObjCARC.h
Modified: llvm/trunk/lib/Transforms/ObjCARC/ObjCARC.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/ObjCARC/ObjCARC.h?rev=178369&r1=178368&r2=178369&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/ObjCARC/ObjCARC.h (original)
+++ llvm/trunk/lib/Transforms/ObjCARC/ObjCARC.h Fri Mar 29 16:15:23 2013
@@ -64,7 +64,8 @@ static inline bool ModuleHasARC(const Mo
M.getNamedValue("objc_copyWeak") ||
M.getNamedValue("objc_retainedObject") ||
M.getNamedValue("objc_unretainedObject") ||
- M.getNamedValue("objc_unretainedPointer");
+ M.getNamedValue("objc_unretainedPointer") ||
+ M.getNamedValue("clang.arc.use");
}
/// \enum InstructionClass
Added: llvm/trunk/test/Transforms/ObjCARC/clang-arc-used-intrinsic-removed-if-isolated.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ObjCARC/clang-arc-used-intrinsic-removed-if-isolated.ll?rev=178369&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/ObjCARC/clang-arc-used-intrinsic-removed-if-isolated.ll (added)
+++ llvm/trunk/test/Transforms/ObjCARC/clang-arc-used-intrinsic-removed-if-isolated.ll Fri Mar 29 16:15:23 2013
@@ -0,0 +1,16 @@
+; RUN: opt -objc-arc-contract -S < %s | FileCheck %s
+
+; This file makes sure that clang.arc.used is removed even if no other ARC
+; interesting calls are in the module.
+
+declare void @clang.arc.use(...) nounwind
+
+; Kill calls to @clang.arc.use(...)
+; CHECK: define void @test0(
+; CHECK-NOT: clang.arc.use
+; CHECK: }
+define void @test0(i8* %a, i8* %b) {
+ call void (...)* @clang.arc.use(i8* %a, i8* %b) nounwind
+ ret void
+}
+
More information about the llvm-commits
mailing list