[cfe-commits] r89412 - in /cfe/trunk: lib/CodeGen/CGRecordLayoutBuilder.cpp lib/CodeGen/CodeGenModule.cpp test/CodeGenCXX/dyncast.cpp test/CodeGenCXX/virt.cpp

Chris Lattner clattner at apple.com
Sun Nov 22 06:31:30 PST 2009


On Nov 19, 2009, at 4:02 PM, Mike Stump wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=89412&view=rev
> Log:
> Fixup key function calculations.

> +++ cfe/trunk/test/CodeGenCXX/dyncast.cpp Thu Nov 19 18:02:19 2009
> @@ -97,7 +97,7 @@
> // CHECK-LL-NEXT:  br i1 %4, label %5, label %9
> // CHECK-LL:       ; <label>:5
> // CHECK-LL-NEXT:  %6 = bitcast %class.test1_A* %tmp to i8*
> -// CHECK-LL-NEXT:  %7 = call i8* @__dynamic_cast(i8* %6, i8* bitcast (i8** @_ZTI7test1_B to i8*), i8* bitcast (i8** @_ZTI7test1_D to i8*), i64 -1)
> +// CHECK-LL-NEXT:  %7 = call i8* @__dynamic_cast(i8* %6, i8* bitcast ({{.*}}

Okay, this is better than grepping the .s file, but this is also really fragile.  I'd strongly suggest removing all of the references to temporary results here (%6, %7, etc) either through use of regex's or by just omitting them.  Checking for 'call i8* @__dynamic_cast' should be sufficient, no?  Likewise, there is no need to check for comments in the .ll file etc.

-Chris

> @_ZTI7test1_B to i8*), i8* bitcast (i8** @_ZTI7test1_D to i8*), i64 -1)
> // CHECK-LL-NEXT:  %8 = bitcast i8* %7 to %class.test1_D*
> // CHECK-LL-NEXT:  br label %10
> // CHECK-LL:       ; <label>:9
> @@ -120,7 +120,7 @@
> // CHECK-LL-NEXT:  br i1 %12, label %13, label %17
> // CHECK-LL:       ; <label>:13
> // CHECK-LL-NEXT:  %14 = bitcast %class.test1_A* %tmp6 to i8*
> -// CHECK-LL-NEXT:  %15 = call i8* @__dynamic_cast(i8* %14, i8* bitcast (i8** @_ZTI7test1_B to i8*), i8* bitcast (i8** @_ZTI7test1_A to i8*), i64 -1)
> +// CHECK-LL-NEXT:  %15 = call i8* @__dynamic_cast(i8* %14, i8* bitcast ({{.*}} @_ZTI7test1_B to i8*), i8* bitcast ({{.*}} @_ZTI7test1_A to i8*), i64 -1)
> // CHECK-LL-NEXT:  %16 = bitcast i8* %15 to %class.test1_A*
> // CHECK-LL-NEXT:  br label %18
> // CHECK-LL:       ; <label>:17
> @@ -143,7 +143,7 @@
> // CHECK-LL-NEXT:  br i1 %20, label %21, label %25
> // CHECK-LL:       ; <label>:21
> // CHECK-LL-NEXT:  %22 = bitcast %class.test1_A* %tmp14 to i8*
> -// CHECK-LL-NEXT:  %23 = call i8* @__dynamic_cast(i8* %22, i8* bitcast (i8** @_ZTI7test1_A to i8*), i8* bitcast (i8** @_ZTI7test1_B to i8*), i64 -1)
> +// CHECK-LL-NEXT:  %23 = call i8* @__dynamic_cast({{.*}} %22, i8* bitcast ({{.*}} @_ZTI7test1_A to i8*), i8* bitcast ({{.*}} @_ZTI7test1_B to i8*), i64 -1)
> // CHECK-LL-NEXT:  %24 = bitcast i8* %23 to %class.test1_A*
> // CHECK-LL-NEXT:  br label %26
> // CHECK-LL:       ; <label>:25
> @@ -214,7 +214,7 @@
> // CHECK-LL-NEXT:  br i1 %34, label %35, label %39
> // CHECK-LL:       ; <label>:35
> // CHECK-LL-NEXT:  %36 = bitcast %class.test1_A* %tmp54 to i8*
> -// CHECK-LL-NEXT:  %37 = call i8* @__dynamic_cast(i8* %36, i8* bitcast (i8** @_ZTI7test1_A to i8*), i8* bitcast (i8** @_ZTI7test1_D to i8*), i64 -1)
> +// CHECK-LL-NEXT:  %37 = call i8* @__dynamic_cast(i8* %36, i8* bitcast ({{.*}} @_ZTI7test1_A to i8*), i8* bitcast ({{.*}} @_ZTI7test1_D to i8*), i64 -1)
> // CHECK-LL-NEXT:  %38 = bitcast i8* %37 to %class.test1_D*
> // CHECK-LL-NEXT:  br label %40
> // CHECK-LL:       ; <label>:39
> @@ -237,7 +237,7 @@
> // CHECK-LL-NEXT:  br i1 %42, label %43, label %47
> // CHECK-LL:       ; <label>:43
> // CHECK-LL-NEXT:  %44 = bitcast %class.test1_A* %tmp63 to i8*
> -// CHECK-LL-NEXT:  %45 = call i8* @__dynamic_cast(i8* %44, i8* bitcast (i8** @_ZTI7test1_A to i8*), i8* bitcast (i8** @_ZTI7test1_E to i8*), i64 -1)
> +// CHECK-LL-NEXT:  %45 = call i8* @__dynamic_cast(i8* %44, i8* bitcast ({{.*}} @_ZTI7test1_A to i8*), i8* bitcast ({{.*}} @_ZTI7test1_E to i8*), i64 -1)
> // CHECK-LL-NEXT:  %46 = bitcast i8* %45 to %class.test1_E*
> // CHECK-LL-NEXT:  br label %48
> // CHECK-LL:       ; <label>:47
> @@ -279,7 +279,7 @@
> // CHECK-LL:       if.end85:
> // CHECK-LL-NEXT:  br i1 false, label %50, label %53
> // CHECK-LL:       ; <label>:50
> -// CHECK-LL-NEXT:  %51 = call i8* @__dynamic_cast(i8* null, i8* bitcast (i8** @_ZTI7test1_A to i8*), i8* bitcast (i8** @_ZTI7test1_D to i8*), i64 -1)
> +// CHECK-LL-NEXT:  %51 = call i8* @__dynamic_cast(i8* null, i8* bitcast ({{.*}}* @_ZTI7test1_A to i8*), i8* bitcast ({{.*}} @_ZTI7test1_D to i8*), i64 -1)
> // CHECK-LL-NEXT:  %52 = bitcast i8* %51 to %class.test1_D*
> // CHECK-LL-NEXT:  br label %54
> // CHECK-LL:       ; <label>:53
> 
> Modified: cfe/trunk/test/CodeGenCXX/virt.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/virt.cpp?rev=89412&r1=89411&r2=89412&view=diff
> 
> ==============================================================================
> --- cfe/trunk/test/CodeGenCXX/virt.cpp (original)
> +++ cfe/trunk/test/CodeGenCXX/virt.cpp Thu Nov 19 18:02:19 2009
> @@ -4,6 +4,11 @@
> // RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -emit-llvm %s -o %t-64.ll
> // RUN: FileCheck -check-prefix LPLL64 --input-file=%t-64.ll %s
> 
> +
> +// CHECK-LP64: main:
> +// CHECK-LP64: movl $1, 12(%rax)
> +// CHECK-LP64: movl $2, 8(%rax)
> +
> struct B {
>   virtual void bar1();
>   virtual void bar2();
> @@ -12,6 +17,12 @@
> void B::bar1() { }
> void B::bar2() { }
> 
> +// CHECK-LP64: __ZTV1B:
> +// CHECK-LP64-NEXT: .space 8
> +// CHECK-LP64-NEXT: .quad __ZTI1B
> +// CHECK-LP64-NEXT: .quad __ZN1B4bar1Ev
> +// CHECK-LP64-NEXT: .quad __ZN1B4bar2Ev
> +
> struct C {
>   virtual void bee1();
>   virtual void bee2();
> @@ -41,6 +52,28 @@
> };
> void F::foo() { }
> 
> +// CHECK-LP64: __ZTV1F:
> +// CHECK-LP64-NEXT: .space 8
> +// CHECK-LP64-NEXT: .quad 16
> +// CHECK-LP64-NEXT: .space 8
> +// CHECK-LP64-NEXT: .space 8
> +// CHECK-LP64-NEXT: .quad __ZTI1F
> +// CHECK-LP64-NEXT: .quad __ZN1D3booEv
> +// CHECK-LP64-NEXT: .quad __ZN1F3fooEv
> +// CHECK-LP64-NEXT: .space 8
> +// CHECK-LP64-NEXT: .space 8
> +// CHECK-LP64-NEXT: .space 8
> +// CHECK-LP64-NEXT: .space 8
> +// CHECK-LP64-NEXT: .space 8
> +// CHECK-LP64-NEXT: .quad 18446744073709551600
> +// CHECK-LP64-NEXT: .quad __ZTI1F
> +// CHECK-LP64-NEXT: .quad __ZN2D13barEv
> +// CHECK-LP64-NEXT: .quad __ZN2D14bar2Ev
> +// CHECK-LP64-NEXT: .quad __ZN2D14bar3Ev
> +// CHECK-LP64-NEXT: .quad __ZN2D14bar4Ev
> +// CHECK-LP64-NEXT: .quad __ZN2D14bar5Ev
> +
> +
> int j;
> void *vp;
> void test2() {
> @@ -79,9 +112,18 @@
>   ap->b = 2;
> }
> 
> -// CHECK-LP64: main:
> -// CHECK-LP64: movl $1, 12(%rax)
> -// CHECK-LP64: movl $2, 8(%rax)
> +// CHECK-LP64: __ZTV1A:
> +// CHECK-LP64-NEXT: .space 8
> +// CHECK-LP64-NEXT: .quad __ZTI1A
> +// CHECK-LP64-NEXT: .quad __ZN1B4bar1Ev
> +// CHECK-LP64-NEXT: .quad __ZN1B4bar2Ev
> +// CHECK-LP64-NEXT: .quad __ZN1A4foo1Ev
> +// CHECK-LP64-NEXT: .quad __ZN1A4foo2Ev
> +// CHECK-LP64-NEXT: .quad 18446744073709551600
> +// CHECK-LP64-NEXT: .quad __ZTI1A
> +// CHECK-LP64-NEXT: .quad __ZN1C4bee1Ev
> +// CHECK-LP64-NEXT: .quad __ZN1C4bee2Ev
> +
> 
> struct test12_A {
>   virtual void foo0() { }
> @@ -675,12 +717,10 @@
> };
> 
> struct test16_D : test16_NV1, virtual test16_B2 {
> -  virtual void bar();
> -  virtual test16_D *foo1();
> +  virtual void bar() { }
> +  virtual test16_D *foo1() { return 0; }
> };
> 
> -void test16_D::bar() { }
> -
> // CHECK-LP64: __ZTV8test16_D:
> // CHECK-LP64-NEXT: .quad 32
> // CHECK-LP64-NEXT: .quad 16
> @@ -1040,45 +1080,6 @@
> 
> 
> 
> -// CHECK-LP64: __ZTV1B:
> -// CHECK-LP64-NEXT: .space 8
> -// CHECK-LP64-NEXT: .quad __ZTI1B
> -// CHECK-LP64-NEXT: .quad __ZN1B4bar1Ev
> -// CHECK-LP64-NEXT: .quad __ZN1B4bar2Ev
> -
> -// CHECK-LP64: __ZTV1A:
> -// CHECK-LP64-NEXT: .space 8
> -// CHECK-LP64-NEXT: .quad __ZTI1A
> -// CHECK-LP64-NEXT: .quad __ZN1B4bar1Ev
> -// CHECK-LP64-NEXT: .quad __ZN1B4bar2Ev
> -// CHECK-LP64-NEXT: .quad __ZN1A4foo1Ev
> -// CHECK-LP64-NEXT: .quad __ZN1A4foo2Ev
> -// CHECK-LP64-NEXT: .quad 18446744073709551600
> -// CHECK-LP64-NEXT: .quad __ZTI1A
> -// CHECK-LP64-NEXT: .quad __ZN1C4bee1Ev
> -// CHECK-LP64-NEXT: .quad __ZN1C4bee2Ev
> -
> -// CHECK-LP64: __ZTV1F:
> -// CHECK-LP64-NEXT: .space 8
> -// CHECK-LP64-NEXT: .quad 16
> -// CHECK-LP64-NEXT: .space 8
> -// CHECK-LP64-NEXT: .space 8
> -// CHECK-LP64-NEXT: .quad __ZTI1F
> -// CHECK-LP64-NEXT: .quad __ZN1D3booEv
> -// CHECK-LP64-NEXT: .quad __ZN1F3fooEv
> -// CHECK-LP64-NEXT: .space 8
> -// CHECK-LP64-NEXT: .space 8
> -// CHECK-LP64-NEXT: .space 8
> -// CHECK-LP64-NEXT: .space 8
> -// CHECK-LP64-NEXT: .space 8
> -// CHECK-LP64-NEXT: .quad 18446744073709551600
> -// CHECK-LP64-NEXT: .quad __ZTI1F
> -// CHECK-LP64-NEXT: .quad __ZN2D13barEv
> -// CHECK-LP64-NEXT: .quad __ZN2D14bar2Ev
> -// CHECK-LP64-NEXT: .quad __ZN2D14bar3Ev
> -// CHECK-LP64-NEXT: .quad __ZN2D14bar4Ev
> -// CHECK-LP64-NEXT: .quad __ZN2D14bar5Ev
> -
> test21_D d21;
> test20_D d20;
> test19_D d19;
> 
> 
> _______________________________________________
> 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