On Mar 7, 2013, at 1:42 PM, Benjamin Kramer <[email protected]> wrote:
> On 07.03.2013, at 22:36, John McCall <[email protected]> wrote:
>> Author: rjmccall
>> Date: Thu Mar  7 15:36:54 2013
>> New Revision: 176654
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=176654&view=rev
>> Log:
>> Evaluate compound literals directly into the result aggregate
>> when that aggregate isn't potentially aliased.
>> 
>> Modified:
>>   cfe/trunk/lib/CodeGen/CGExprAgg.cpp
>>   cfe/trunk/test/CodeGen/compound-literal.c
>> 
>> Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=176654&r1=176653&r2=176654&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Thu Mar  7 15:36:54 2013
>> @@ -531,12 +531,10 @@ void AggExprEmitter::VisitOpaqueValueExp
>> 
>> void
>> AggExprEmitter::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
>> -  if (E->getType().isPODType(CGF.getContext())) {
>> +  if (Dest.isPotentiallyAliased() &&
>> +      E->getType().isPODType(CGF.getContext())) {
> 
> Does this really depend on the C++ version in use or could it always use the 
> more lenient C++11 definition of POD?

The check was originally intended to be more about trivial copyability, I 
think.  I was thinking about this when I made the patch, and the type part of 
the check should probably just be removed — none of the C++ cases where it's 
important not to assume trivial copyability should be setting the "potentially 
aliased" flag.  I didn't really want to do that investigation at the time, 
though.

John.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to