diff options
| author | Saleem Abdulrasool <compnerd@compnerd.org> | 2017-05-05 18:39:06 +0000 |
|---|---|---|
| committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2017-05-05 18:39:06 +0000 |
| commit | d95f625000b52b91dc50692e4a015f73483506d6 (patch) | |
| tree | 374738aa3e366b4ebcc527c52a0ff3c428909884 /clang/lib | |
| parent | ac1a97b32fbc2d8f1a95f76714c5b729b6f251ce (diff) | |
| download | bcm5719-llvm-d95f625000b52b91dc50692e4a015f73483506d6.tar.gz bcm5719-llvm-d95f625000b52b91dc50692e4a015f73483506d6.zip | |
CodeGen: avoid use of @clang.arc.use intrinsic at O0
The clang.arc.use intrinsic is removed via the ARC Contract Pass. This
pass is only executed in optimized builds (>= opt level 1). Prevent the
optimization implemented in SVN r301667 from triggering at optimization
level 0 like every other ARC use intrinsic usage.
llvm-svn: 302270
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/CodeGen/CGBlocks.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp index 791a57e61f5..2b2a92dd601 100644 --- a/clang/lib/CodeGen/CGBlocks.cpp +++ b/clang/lib/CodeGen/CGBlocks.cpp @@ -623,9 +623,13 @@ static void enterBlockScope(CodeGenFunction &CGF, BlockDecl *block) { // For const-qualified captures, emit clang.arc.use to ensure the captured // object doesn't get released while we are still depending on its validity // within the block. - if (VT.isConstQualified() && VT.getObjCLifetime() == Qualifiers::OCL_Strong) + if (VT.isConstQualified() && + VT.getObjCLifetime() == Qualifiers::OCL_Strong && + CGF.CGM.getCodeGenOpts().OptimizationLevel != 0) { + assert(CGF.CGM.getLangOpts().ObjCAutoRefCount && + "expected ObjC ARC to be enabled"); destroyer = CodeGenFunction::emitARCIntrinsicUse; - else if (dtorKind == QualType::DK_objc_strong_lifetime) { + } else if (dtorKind == QualType::DK_objc_strong_lifetime) { destroyer = CodeGenFunction::destroyARCStrongImprecise; } else { destroyer = CGF.getDestroyer(dtorKind); |

