[cfe-commits] r128157 - /cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
Andrew Trick
atrick at apple.com
Wed Mar 23 12:43:59 PDT 2011
Author: atrick
Date: Wed Mar 23 14:43:59 2011
New Revision: 128157
URL: http://llvm.org/viewvc/llvm-project?rev=128157&view=rev
Log:
Revert r128156 because of CodeGenObjC/messages.m and Coverage/codegen-gnu.m.
Modified:
cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=128157&r1=128156&r2=128157&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Wed Mar 23 14:43:59 2011
@@ -521,12 +521,9 @@
Types.push_back(TypedSelector(TypeEncoding, SelValue));
}
- if (lval) {
- llvm::Value *tmp = Builder.CreateAlloca(SelValue->getType());
- Builder.CreateStore(SelValue, tmp);
- return tmp;
- }
- return SelValue;
+ if (lval)
+ return SelValue;
+ return Builder.CreateLoad(SelValue);
}
llvm::Value *CGObjCGNU::GetSelector(CGBuilderTy &Builder, Selector Sel,
@@ -1909,12 +1906,16 @@
llvm::Constant *Idxs[] = {Zeros[0],
llvm::ConstantInt::get(llvm::Type::getInt32Ty(VMContext), i), Zeros[0]};
// FIXME: We're generating redundant loads and stores here!
- llvm::Constant *SelPtr = llvm::ConstantExpr::getGetElementPtr(SelectorList,
- Idxs, 2);
+ llvm::Constant *SelPtr = new llvm::GlobalVariable(TheModule, SelStructPtrTy,
+ true, llvm::GlobalValue::InternalLinkage,
+ llvm::ConstantExpr::getGetElementPtr(SelectorList, Idxs, 2),
+ ".objc_sel_ptr");
// If selectors are defined as an opaque type, cast the pointer to this
// type.
- SelPtr = llvm::ConstantExpr::getBitCast(SelPtr,
+ if (isSelOpaque) {
+ SelPtr = llvm::ConstantExpr::getBitCast(SelPtr,
llvm::PointerType::getUnqual(SelectorTy));
+ }
SelectorAliases[i]->replaceAllUsesWith(SelPtr);
SelectorAliases[i]->eraseFromParent();
}
More information about the cfe-commits
mailing list