diff options
author | Akira Hatanaka <ahatanaka@apple.com> | 2017-04-15 05:44:27 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@apple.com> | 2017-04-15 05:44:27 +0000 |
commit | f8a27a96e2f0d5078e7836fd831c292a070162d1 (patch) | |
tree | fdb63e44dff1cd329518273257798b5d4b1f244f /clang/lib/CodeGen | |
parent | 9b25fb7f4b5f0a4e9a99b32c8e08d57586c2ad34 (diff) | |
download | bcm5719-llvm-f8a27a96e2f0d5078e7836fd831c292a070162d1.tar.gz bcm5719-llvm-f8a27a96e2f0d5078e7836fd831c292a070162d1.zip |
Revert "[ObjC] Use empty Objective-C collection literal constants when"
This reverts commit r300389. There were mistakes in the changes I made
to CodeGen.
llvm-svn: 300391
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGObjC.cpp | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index 067718e2b8e..c011ab4dfc9 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/lib/CodeGen/CGObjC.cpp @@ -117,22 +117,10 @@ llvm::Value *CodeGenFunction::EmitObjCCollectionLiteral(const Expr *E, const ObjCArrayLiteral *ALE = dyn_cast<ObjCArrayLiteral>(E); if (!ALE) DLE = cast<ObjCDictionaryLiteral>(E); - - // Optimize empty collections by referencing constants, when available. + + // Compute the type of the array we're initializing. uint64_t NumElements = ALE ? ALE->getNumElements() : DLE->getNumElements(); - if (NumElements == 0 && CGM.getLangOpts().ObjCRuntime.hasEmptyCollections()) { - StringRef ConstantName = ALE ? "__NSArray0__" : "__NSDictionary0__"; - QualType IdTy(CGM.getContext().getObjCIdType()); - llvm::Constant *Constant = - CGM.CreateRuntimeVariable(ConvertType(IdTy), ConstantName); - LValue LV = LValue::MakeAddr(Constant, IdTy, - Context.getTypeAlignInChars(IdTy), Context); - return Builder.CreateBitCast(EmitLoadOfScalar(LV, E->getLocStart()), - ConvertType(E->getType())); - } - - // Compute the type of the array we're initializing. llvm::APInt APNumElements(Context.getTypeSize(Context.getSizeType()), NumElements); QualType ElementType = Context.getObjCIdType().withConst(); |