[cfe-commits] r138655 - in /cfe/trunk: lib/CodeGen/CGCall.cpp lib/CodeGen/CGExpr.cpp test/CodeGenObjCXX/arc-references.mm
John McCall
rjmccall at apple.com
Fri Aug 26 14:08:14 PDT 2011
Author: rjmccall
Date: Fri Aug 26 16:08:13 2011
New Revision: 138655
URL: http://llvm.org/viewvc/llvm-project?rev=138655&view=rev
Log:
Slight optimization enabled by the previous assert:
emit all gl-value arguments as reference bindings.
Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/test/CodeGenObjCXX/arc-references.mm
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=138655&r1=138654&r2=138655&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Fri Aug 26 16:08:13 2011
@@ -1434,9 +1434,11 @@
assert(type->isReferenceType() == E->isGLValue() &&
"reference binding to unmaterialized r-value!");
- if (type->isReferenceType())
+ if (E->isGLValue()) {
+ assert(E->getObjectKind() == OK_Ordinary);
return args.add(EmitReferenceBindingToExpr(E, /*InitializedDecl=*/0),
type);
+ }
if (hasAggregateLLVMType(type) && !E->getType()->isAnyComplexType() &&
isa<ImplicitCastExpr>(E) &&
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=138655&r1=138654&r2=138655&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Fri Aug 26 16:08:13 2011
@@ -2150,8 +2150,7 @@
LValue CodeGenFunction::EmitMaterializeTemporaryExpr(
const MaterializeTemporaryExpr *E) {
- RValue RV = EmitReferenceBindingToExpr(E->GetTemporaryExpr(),
- /*InitializedDecl=*/0);
+ RValue RV = EmitReferenceBindingToExpr(E, /*InitializedDecl=*/0);
return MakeAddrLValue(RV.getScalarVal(), E->getType());
}
Modified: cfe/trunk/test/CodeGenObjCXX/arc-references.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/arc-references.mm?rev=138655&r1=138654&r2=138655&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjCXX/arc-references.mm (original)
+++ cfe/trunk/test/CodeGenObjCXX/arc-references.mm Fri Aug 26 16:08:13 2011
@@ -61,8 +61,9 @@
// CHECK: define void @_Z5test5RU8__strongP11objc_object
void test5(__strong id &x) {
- // CHECK: [[OBJ_ID:%[a-zA-Z0-9]+]] = call i8* @objc_retain
- // CHECK-NEXT: [[OBJ_A:%[a-zA-Z0-9]+]] = bitcast i8* [[OBJ_ID]] to [[A:%[a-zA-Z0-9]+]]*
+ // CHECK: [[REFTMP:%.*]] = alloca {{%.*}}*, align 8
+ // CHECK: [[OBJ_ID:%.*]] = call i8* @objc_retain(
+ // CHECK-NEXT: [[OBJ_A:%.*]] = bitcast i8* [[OBJ_ID]] to [[A:%[a-zA-Z0-9]+]]*
// CHECK-NEXT: store [[A]]* [[OBJ_A]], [[A]]** [[REFTMP:%[a-zA-Z0-9]+]]
// CHECK-NEXT: call void @_Z4sinkOU8__strongP1A
sink(x);
More information about the cfe-commits
mailing list