[cfe-commits] r148359 - in /cfe/trunk: lib/CodeGen/CGStmt.cpp test/CodeGenCXX/switch-case-folding-2.cpp

jahanian fjahanian at apple.com
Tue Jan 17 16:10:44 PST 2012


On Jan 17, 2012, at 4:00 PM, Eli Friedman wrote:

> On Tue, Jan 17, 2012 at 3:39 PM, Fariborz Jahanian <fjahanian at apple.com> wrote:
>> Author: fjahanian
>> Date: Tue Jan 17 17:39:50 2012
>> New Revision: 148359
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=148359&view=rev
>> Log:
>> Folding away unreachable case statement.
>> patch (slightly revised) by Aaron Ballman.
>> 
>> 
>> Added:
>>    cfe/trunk/test/CodeGenCXX/switch-case-folding-2.cpp
>> Modified:
>>    cfe/trunk/lib/CodeGen/CGStmt.cpp
>> 
>> Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=148359&r1=148358&r2=148359&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGStmt.cpp Tue Jan 17 17:39:50 2012
>> @@ -883,10 +883,8 @@
>>   // when we've constant-folded the switch, are emitting the constant case,
>>   // and part of the constant case includes another case statement.  For
>>   // instance: switch (4) { case 4: do { case 5: } while (1); }
>> -  if (!SwitchInsn) {
>> -    EmitStmt(S.getSubStmt());
>> +  if (!SwitchInsn)
>>     return;
>> -  }
> 
> What is the intent of this change?  It looks wrong.

Fixed in r148361.

- Fariborz





More information about the cfe-commits mailing list