From 6a5184a7b70d9cea6e53b86c71469ea3e196e271 Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Tue, 30 Jan 2018 20:19:34 +0000 Subject: [PATCH] Revert "CodeGen: annotate ObjC ARC functions with ABI constraints" This reverts commit r294872. Although this patch is correct, it caused the objc_autoreleaseRValue/objc_retainAutoreleasedReturnValue git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323814 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGObjC.cpp | 19 ------------------- test/CodeGenObjC/arc.m | 24 +++++++++++------------- 2 files changed, 11 insertions(+), 32 deletions(-) diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp index 43f34e7965..d2175f00b4 100644 --- a/lib/CodeGen/CGObjC.cpp +++ b/lib/CodeGen/CGObjC.cpp @@ -1815,22 +1815,6 @@ void CodeGenFunction::EmitARCIntrinsicUse(ArrayRef values) { } -static bool IsForwarding(StringRef Name) { - return llvm::StringSwitch(Name) - .Cases("objc_autoreleaseReturnValue", // ARCInstKind::AutoreleaseRV - "objc_autorelease", // ARCInstKind::Autorelease - "objc_retainAutoreleaseReturnValue", // ARCInstKind::FusedRetainAutoreleaseRV - "objc_retainAutoreleasedReturnValue", // ARCInstKind::RetainRV - "objc_retainAutorelease", // ARCInstKind::FusedRetainAutorelease - "objc_retainedObject", // ARCInstKind::NoopCast - "objc_retain", // ARCInstKind::Retain - "objc_unretainedObject", // ARCInstKind::NoopCast - "objc_unretainedPointer", // ARCInstKind::NoopCast - "objc_unsafeClaimAutoreleasedReturnValue", // ARCInstKind::ClaimRV - true) - .Default(false); -} - static llvm::Constant *createARCRuntimeFunction(CodeGenModule &CGM, llvm::FunctionType *FTy, StringRef Name) { @@ -1848,9 +1832,6 @@ static llvm::Constant *createARCRuntimeFunction(CodeGenModule &CGM, // performance. F->addFnAttr(llvm::Attribute::NonLazyBind); } - - if (IsForwarding(Name)) - F->arg_begin()->addAttr(llvm::Attribute::Returned); } return RTF; diff --git a/test/CodeGenObjC/arc.m b/test/CodeGenObjC/arc.m index 28650cd00b..8772ac5d6d 100644 --- a/test/CodeGenObjC/arc.m +++ b/test/CodeGenObjC/arc.m @@ -7,30 +7,30 @@ // RUN: %clang_cc1 -fobjc-runtime=macosx-10.7.0 -triple x86_64-apple-darwin11 -Wno-objc-root-class -Wno-incompatible-pointer-types -Wno-arc-unsafe-retained-assign -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -o - %s | FileCheck -check-prefix=ARC-NATIVE %s // ARC-ALIEN: declare extern_weak void @objc_storeStrong(i8**, i8*) -// ARC-ALIEN: declare extern_weak i8* @objc_retain(i8* returned) -// ARC-ALIEN: declare extern_weak i8* @objc_autoreleaseReturnValue(i8* returned) +// ARC-ALIEN: declare extern_weak i8* @objc_retain(i8*) +// ARC-ALIEN: declare extern_weak i8* @objc_autoreleaseReturnValue(i8*) // ARC-ALIEN: declare i8* @objc_msgSend(i8*, i8*, ...) [[NLB:#[0-9]+]] // ARC-ALIEN: declare extern_weak void @objc_release(i8*) -// ARC-ALIEN: declare extern_weak i8* @objc_retainAutoreleasedReturnValue(i8* returned) +// ARC-ALIEN: declare extern_weak i8* @objc_retainAutoreleasedReturnValue(i8*) // ARC-ALIEN: declare extern_weak i8* @objc_initWeak(i8**, i8*) // ARC-ALIEN: declare extern_weak i8* @objc_storeWeak(i8**, i8*) // ARC-ALIEN: declare extern_weak i8* @objc_loadWeakRetained(i8**) // ARC-ALIEN: declare extern_weak void @objc_destroyWeak(i8**) -// declare extern_weak i8* @objc_autorelease(i8*) -// ARC-ALIEN: declare extern_weak i8* @objc_retainAutorelease(i8* returned) +// ARC-ALIEN: declare extern_weak i8* @objc_autorelease(i8*) +// ARC-ALIEN: declare extern_weak i8* @objc_retainAutorelease(i8*) // ARC-NATIVE: declare void @objc_storeStrong(i8**, i8*) -// ARC-NATIVE: declare i8* @objc_retain(i8* returned) [[NLB:#[0-9]+]] -// ARC-NATIVE: declare i8* @objc_autoreleaseReturnValue(i8* returned) +// ARC-NATIVE: declare i8* @objc_retain(i8*) [[NLB:#[0-9]+]] +// ARC-NATIVE: declare i8* @objc_autoreleaseReturnValue(i8*) // ARC-NATIVE: declare i8* @objc_msgSend(i8*, i8*, ...) [[NLB]] // ARC-NATIVE: declare void @objc_release(i8*) [[NLB]] -// ARC-NATIVE: declare i8* @objc_retainAutoreleasedReturnValue(i8* returned) +// ARC-NATIVE: declare i8* @objc_retainAutoreleasedReturnValue(i8*) // ARC-NATIVE: declare i8* @objc_initWeak(i8**, i8*) // ARC-NATIVE: declare i8* @objc_storeWeak(i8**, i8*) // ARC-NATIVE: declare i8* @objc_loadWeakRetained(i8**) // ARC-NATIVE: declare void @objc_destroyWeak(i8**) -// declare i8* @objc_autorelease(i8*) -// ARC-NATIVE: declare i8* @objc_retainAutorelease(i8* returned) +// ARC-NATIVE: declare i8* @objc_autorelease(i8*) +// ARC-NATIVE: declare i8* @objc_retainAutorelease(i8*) // CHECK-LABEL: define void @test0 void test0(id x) { @@ -1504,9 +1504,7 @@ void test68(void) { // CHECK: [[SELF:%.*]] = alloca [[TEST69:%.*]]*, align 8 // CHECK: [[T0:%.*]] = load [[TEST69]]*, [[TEST69]]** [[SELF]], align 8 // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST69]]* [[T0]] to i8* -// CHECK-NEXT: [[RETAIN:%.*]] = call i8* @objc_retain(i8* [[T1]]) -// CHECK-NEXT: [[AUTORELEASE:%.*]] = tail call i8* @objc_autoreleaseReturnValue(i8* [[RETAIN]]) -// CHECK-NEXT: ret i8* [[AUTORELEASE]] +// CHECK-NEXT: ret i8* [[T1]] // rdar://problem/10907547 void test70(id i) { -- 2.40.0