r183206 - Remove some unreachable (and wrong) code and replace it with an assertion.
Richard Smith
richard-llvm at metafoo.co.uk
Mon Jun 3 21:45:04 PDT 2013
Author: rsmith
Date: Mon Jun 3 23:45:03 2013
New Revision: 183206
URL: http://llvm.org/viewvc/llvm-project?rev=183206&view=rev
Log:
Remove some unreachable (and wrong) code and replace it with an assertion.
Modified:
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/test/CodeGenCXX/temporaries.cpp
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=183206&r1=183205&r2=183206&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Mon Jun 3 23:45:03 2013
@@ -361,19 +361,9 @@ EmitExprForReferenceBinding(CodeGenFunct
case SubobjectAdjustment::FieldAdjustment: {
LValue LV = CGF.MakeAddrLValue(Object, E->getType());
LV = CGF.EmitLValueForField(LV, Adjustment.Field);
- if (LV.isSimple()) {
- Object = LV.getAddress();
- break;
- }
-
- // For non-simple lvalues, we actually have to create a copy of
- // the object we're binding to.
- QualType T = Adjustment.Field->getType().getNonReferenceType()
- .getUnqualifiedType();
- Object = CreateReferenceTemporary(CGF, T, InitializedDecl);
- LValue TempLV = CGF.MakeAddrLValue(Object,
- Adjustment.Field->getType());
- CGF.EmitStoreThroughLValue(CGF.EmitLoadOfLValue(LV), TempLV);
+ assert(LV.isSimple() &&
+ "materialized temporary field is not a simple lvalue");
+ Object = LV.getAddress();
break;
}
Modified: cfe/trunk/test/CodeGenCXX/temporaries.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/temporaries.cpp?rev=183206&r1=183205&r2=183206&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/temporaries.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/temporaries.cpp Mon Jun 3 23:45:03 2013
@@ -616,3 +616,25 @@ namespace Bitfield {
// CHECK: store i32* @_ZGRN8Bitfield1rE, i32** @_ZN8Bitfield1rE, align 8
int &&r = S().a;
}
+
+namespace Vector {
+ typedef __attribute__((vector_size(16))) int vi4a;
+ typedef __attribute__((ext_vector_type(4))) int vi4b;
+ struct S {
+ vi4a v;
+ vi4b w;
+ };
+ // CHECK: alloca
+ // CHECK: extractelement
+ // CHECK: store i32 {{.*}}, i32* @_ZGRN6Vector1rE,
+ // CHECK: store i32* @_ZGRN6Vector1rE, i32** @_ZN6Vector1rE,
+ int &&r = S().v[1];
+
+ // CHECK: alloca
+ // CHECK: extractelement
+ // CHECK: store i32 {{.*}}, i32* @_ZGRN6Vector1sE,
+ // CHECK: store i32* @_ZGRN6Vector1sE, i32** @_ZN6Vector1sE,
+ int &&s = S().w[1];
+ // FIXME PR16204: The following code leads to an assertion in Sema.
+ //int &&s = S().w.y;
+}
More information about the cfe-commits
mailing list