[cfe-commits] r148245 - /cfe/trunk/test/CodeGenCXX/switch-case-folding.cpp

David Blaikie dblaikie at gmail.com
Mon Jan 16 10:45:30 PST 2012


On Mon, Jan 16, 2012 at 10:07 AM, Fariborz Jahanian <fjahanian at apple.com> wrote:
> Author: fjahanian
> Date: Mon Jan 16 12:07:45 2012
> New Revision: 148245
>
> URL: http://llvm.org/viewvc/llvm-project?rev=148245&view=rev
> Log:
> A little more elaborate test for r148243
>
> Modified:
>    cfe/trunk/test/CodeGenCXX/switch-case-folding.cpp
>
> Modified: cfe/trunk/test/CodeGenCXX/switch-case-folding.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/switch-case-folding.cpp?rev=148245&r1=148244&r2=148245&view=diff
> ==============================================================================
> --- cfe/trunk/test/CodeGenCXX/switch-case-folding.cpp (original)
> +++ cfe/trunk/test/CodeGenCXX/switch-case-folding.cpp Mon Jan 16 12:07:45 2012
> @@ -6,7 +6,13 @@
>        // Make sure we don't crash when constant folding the case 4
>        // statement due to the case 5 statement contained in the do loop
>        switch (4) {
> -               case 4: do { case 5: x++;} while (x < 100);
> +               case 4: do {
> +                     switch (6)  {
> +                       case 6: {
> +                         case 5: x++;
> +                       };
> +                     };
> +                } while (x < 100);
>        }
>        return x;
>  }

I wonder what happens when the switchless case ("case 5: x++" in the
test above) is the same as a case that already exists in the unfolded
switch ("switch (4)" in the test above) eg: by changing "case 5:" to
"case 4:" - does that create some weird conflict of case labels? I'll
have a go at this once I sync/rebuild/etc.

- David




More information about the cfe-commits mailing list