r193995 - CodeGen: Test that simple expressions are simplified at -O0

Rafael EspĂ­ndola rafael.espindola at gmail.com
Mon Nov 4 08:21:50 PST 2013


We normally commit the tests in the same patch that changed the code...

On 4 November 2013 08:13, Justin Bogner <mail at justinbogner.com> wrote:
> Author: bogner
> Date: Mon Nov  4 10:13:23 2013
> New Revision: 193995
>
> URL: http://llvm.org/viewvc/llvm-project?rev=193995&view=rev
> Log:
> CodeGen: Test that simple expressions are simplified at -O0
>
> Added:
>     cfe/trunk/test/CodeGen/branch-on-bool.c
>
> Added: cfe/trunk/test/CodeGen/branch-on-bool.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/branch-on-bool.c?rev=193995&view=auto
> ==============================================================================
> --- cfe/trunk/test/CodeGen/branch-on-bool.c (added)
> +++ cfe/trunk/test/CodeGen/branch-on-bool.c Mon Nov  4 10:13:23 2013
> @@ -0,0 +1,22 @@
> +// RUN: %clang %s -O0 -emit-llvm -S -o - | FileCheck %s
> +
> +void foo();
> +void bar();
> +
> +void fold_if(int a, int b) {
> +  // CHECK: define {{.*}} @fold_if(
> +  // CHECK-NOT: = phi
> +  // CHECK: }
> +  if (a && b)
> +    foo();
> +  else
> +    bar();
> +}
> +
> +void fold_for(int a, int b) {
> +  // CHECK: define {{.*}} @fold_for(
> +  // CHECK-NOT: = phi
> +  // CHECK: }
> +  for (int i = 0; a && i < b; ++i) foo();
> +  for (int i = 0; a || i < b; ++i) bar();
> +}
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list