summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorBjörn Steinbrink <bsteinbr@gmail.com>2015-05-24 18:07:52 +0200
committerBjörn Steinbrink <bsteinbr@gmail.com>2015-05-27 12:08:31 +0200
commit677367599e8383c355b8e8261cafe3ce44c9c6de (patch)
treec784e078189f4fcbcd85a0f4aca51968453db64e /src/test/codegen
parentba0e1cd8147d452c356aacb29fb87568ca26f111 (diff)
downloadrust-677367599e8383c355b8e8261cafe3ce44c9c6de.tar.gz
rust-677367599e8383c355b8e8261cafe3ce44c9c6de.zip
Revamp codegen tests to check IR quality instead of quantity
The current codegen tests only compare IR line counts between similar
rust and C programs, the latter getting compiled with clang. That looked
like a good idea back then, but actually things like lifetime intrinsics
mean that less IR isn't always better, so the metric isn't really
helpful.

Instead, we can start doing tests that check specific aspects of the
generated IR, like attributes or metadata. To do that, we can use LLVM's
FileCheck tool which has a number of useful features for such tests.

To start off, I created some tests for a few things that were recently
added and/or broken.
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/function-arguments.rs95
-rw-r--r--src/test/codegen/iterate-over-array.cc27
-rw-r--r--src/test/codegen/iterate-over-array.rs20
-rw-r--r--src/test/codegen/loads.rs52
-rw-r--r--src/test/codegen/scalar-function-call.cc20
-rw-r--r--src/test/codegen/scalar-function-call.rs18
-rw-r--r--src/test/codegen/single-return-value.cc14
-rw-r--r--src/test/codegen/single-return-value.rs14
-rw-r--r--src/test/codegen/small-dense-int-switch.cc21
-rw-r--r--src/test/codegen/small-dense-int-switch.rs19
-rw-r--r--src/test/codegen/stack-alloc-string-slice.cc22
-rw-r--r--src/test/codegen/stack-alloc-string-slice.rs14
-rw-r--r--src/test/codegen/static-method-call-multi.cc27
-rw-r--r--src/test/codegen/static-method-call-multi.rs28
-rw-r--r--src/test/codegen/static-method-call.cc23
-rw-r--r--src/test/codegen/static-method-call.rs24
-rw-r--r--src/test/codegen/stores.rs45
-rw-r--r--src/test/codegen/virtual-method-call-struct-return.cc25
-rw-r--r--src/test/codegen/virtual-method-call-struct-return.rs23
-rw-r--r--src/test/codegen/virtual-method-call.cc20
-rw-r--r--src/test/codegen/virtual-method-call.rs18
21 files changed, 192 insertions, 377 deletions
diff --git a/src/test/codegen/function-arguments.rs b/src/test/codegen/function-arguments.rs
new file mode 100644
index 00000000000..f11e769ca6c
--- /dev/null
+++ b/src/test/codegen/function-arguments.rs
@@ -0,0 +1,95 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -C no-prepopulate-passes
+
+#![feature(allocator)]
+
+pub struct S {
+  _field: [i64; 4],
+}
+
+pub struct UnsafeInner {
+  _field: std::cell::UnsafeCell<i16>,
+}
+
+// CHECK: zeroext i1 @boolean(i1 zeroext)
+#[no_mangle]
+pub fn boolean(x: bool) -> bool {
+  x
+}
+
+// CHECK: @readonly_borrow(i32* noalias readonly dereferenceable(4))
+// FIXME #25759 This should also have `nocapture`
+#[no_mangle]
+pub fn readonly_borrow(_: &i32) {
+}
+
+// CHECK: @static_borrow(i32* noalias readonly dereferenceable(4))
+// static borrow may be captured
+#[no_mangle]
+pub fn static_borrow(_: &'static i32) {
+}
+
+// CHECK: @named_borrow(i32* noalias readonly dereferenceable(4))
+// borrow with named lifetime may be captured
+#[no_mangle]
+pub fn named_borrow<'r>(_: &'r i32) {
+}
+
+// CHECK: @unsafe_borrow(%UnsafeInner* dereferenceable(2))
+// unsafe interior means this isn't actually readonly and there may be aliases ...
+#[no_mangle]
+pub fn unsafe_borrow(_: &UnsafeInner) {
+}
+
+// CHECK: @mutable_unsafe_borrow(%UnsafeInner* noalias dereferenceable(2))
+// ... unless this is a mutable borrow, those never alias
+#[no_mangle]
+pub fn mutable_unsafe_borrow(_: &mut UnsafeInner) {
+}
+
+// CHECK: @mutable_borrow(i32* noalias dereferenceable(4))
+// FIXME #25759 This should also have `nocapture`
+#[no_mangle]
+pub fn mutable_borrow(_: &mut i32) {
+}
+
+// CHECK: @indirect_struct(%S* noalias nocapture dereferenceable(32))
+#[no_mangle]
+pub fn indirect_struct(_: S) {
+}
+
+// CHECK: @borrowed_struct(%S* noalias readonly dereferenceable(32))
+// FIXME #25759 This should also have `nocapture`
+#[no_mangle]
+pub fn borrowed_struct(_: &S) {
+}
+
+// CHECK: noalias dereferenceable(4) i32* @_box(i32* noalias dereferenceable(4))
+#[no_mangle]
+pub fn _box(x: Box<i32>) -> Box<i32> {
+  x
+}
+
+// CHECK: @struct_return(%S* noalias nocapture sret dereferenceable(32))
+#[no_mangle]
+pub fn struct_return() -> S {
+  S {
+    _field: [0, 0, 0, 0]
+  }
+}
+
+// CHECK: noalias i8* @allocator()
+#[no_mangle]
+#[allocator]
+pub fn allocator() -> *const i8 {
+  std::ptr::null()
+}
diff --git a/src/test/codegen/iterate-over-array.cc b/src/test/codegen/iterate-over-array.cc
deleted file mode 100644
index 9261bddb747..00000000000
--- a/src/test/codegen/iterate-over-array.cc
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#include <stdlib.h>
-#include <assert.h>
-
-struct slice {
-  int const *p;
-  size_t len;
-};
-
-extern "C"
-size_t test(slice s) {
-  size_t y = 0;
-  for (int i = 0; i < s.len; ++i) {
-	assert(i < s.len);
-	y += s.p[i];
-  }
-  return y;
-}
diff --git a/src/test/codegen/iterate-over-array.rs b/src/test/codegen/iterate-over-array.rs
deleted file mode 100644
index a5b449285ef..00000000000
--- a/src/test/codegen/iterate-over-array.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[no_mangle]
-pub fn test(x: &[isize]) -> isize {
-    let mut y = 0;
-    let mut i = 0;
-    while (i < x.len()) {
-        y += x[i];
-        i += 1;
-    }
-    y
-}
diff --git a/src/test/codegen/loads.rs b/src/test/codegen/loads.rs
new file mode 100644
index 00000000000..20a55740bb7
--- /dev/null
+++ b/src/test/codegen/loads.rs
@@ -0,0 +1,52 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -C no-prepopulate-passes
+
+pub struct Bytes {
+  a: u8,
+  b: u8,
+  c: u8,
+  d: u8,
+}
+
+// CHECK-LABEL: @borrow
+#[no_mangle]
+pub fn borrow(x: &i32) -> &i32 {
+// CHECK: load i32** %x{{.*}}, !nonnull
+    x
+}
+
+// CHECK-LABEL: @_box
+#[no_mangle]
+pub fn _box(x: Box<i32>) -> i32 {
+// CHECK: load i32** %x{{.*}}, !nonnull
+    *x
+}
+
+// CHECK-LABEL: small_array_alignment
+// The array is loaded as i32, but its alignment is lower, go with 1 byte to avoid target
+// dependent alignment
+#[no_mangle]
+pub fn small_array_alignment(x: [i8; 4]) -> [i8; 4] {
+// CHECK: [[VAR:%[0-9]+]] = load i32* %{{.*}}, align 1
+// CHECK: ret i32 [[VAR]]
+    x
+}
+
+// CHECK-LABEL: small_struct_alignment
+// The struct is loaded as i32, but its alignment is lower, go with 1 byte to avoid target
+// dependent alignment
+#[no_mangle]
+pub fn small_struct_alignment(x: Bytes) -> Bytes {
+// CHECK: [[VAR:%[0-9]+]] = load i32* %{{.*}}, align 1
+// CHECK: ret i32 [[VAR]]
+    x
+}
diff --git a/src/test/codegen/scalar-function-call.cc b/src/test/codegen/scalar-function-call.cc
deleted file mode 100644
index ce3173ce464..00000000000
--- a/src/test/codegen/scalar-function-call.cc
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#include <stdlib.h>
-
-size_t foo(size_t x) {
-    return x * x;
-}
-
-extern "C"
-void test() {
-    size_t x = foo(10);
-}
diff --git a/src/test/codegen/scalar-function-call.rs b/src/test/codegen/scalar-function-call.rs
deleted file mode 100644
index fe93c864fad..00000000000
--- a/src/test/codegen/scalar-function-call.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn foo(x: isize) -> isize {
-    x * x
-}
-
-#[no_mangle]
-pub fn test() {
-    let _x = foo(10);
-}
diff --git a/src/test/codegen/single-return-value.cc b/src/test/codegen/single-return-value.cc
deleted file mode 100644
index 97d80d3950f..00000000000
--- a/src/test/codegen/single-return-value.cc
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-extern "C"
-int test() {
-  return 5;
-}
diff --git a/src/test/codegen/single-return-value.rs b/src/test/codegen/single-return-value.rs
deleted file mode 100644
index 5addba1724d..00000000000
--- a/src/test/codegen/single-return-value.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[no_mangle]
-pub fn test() -> isize {
-    5
-}
diff --git a/src/test/codegen/small-dense-int-switch.cc b/src/test/codegen/small-dense-int-switch.cc
deleted file mode 100644
index db93829c62b..00000000000
--- a/src/test/codegen/small-dense-int-switch.cc
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#include <stdlib.h>
-
-extern "C"
-size_t test(size_t x, size_t y) {
-  switch (x) {
-  case 1: return y;
-  case 2: return y*2;
-  case 4: return y*3;
-  default: return 11;
-  }
-}
diff --git a/src/test/codegen/small-dense-int-switch.rs b/src/test/codegen/small-dense-int-switch.rs
deleted file mode 100644
index cf05a2e2f8e..00000000000
--- a/src/test/codegen/small-dense-int-switch.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[no_mangle]
-pub fn test(x: isize, y: isize) -> isize {
-    match x {
-        1 => y,
-        2 => y*2,
-        4 => y*3,
-        _ => 11
-    }
-}
diff --git a/src/test/codegen/stack-alloc-string-slice.cc b/src/test/codegen/stack-alloc-string-slice.cc
deleted file mode 100644
index a81f76eee0b..00000000000
--- a/src/test/codegen/stack-alloc-string-slice.cc
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#include <stddef.h>
-
-struct slice {
-  char const *p;
-  size_t len;
-};
-
-extern "C"
-void test() {
-  struct slice s = { .p = "hello",
-                     .len = 5 };
-}
diff --git a/src/test/codegen/stack-alloc-string-slice.rs b/src/test/codegen/stack-alloc-string-slice.rs
deleted file mode 100644
index 188ee246bf3..00000000000
--- a/src/test/codegen/stack-alloc-string-slice.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[no_mangle]
-pub fn test() {
-    let _x = "hello";
-}
diff --git a/src/test/codegen/static-method-call-multi.cc b/src/test/codegen/static-method-call-multi.cc
deleted file mode 100644
index 6c03e32b98c..00000000000
--- a/src/test/codegen/static-method-call-multi.cc
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#include <stdlib.h>
-
-struct Struct {
-  size_t field;
-  size_t method(size_t x) {
-	return this->field + x;
-  }
-};
-
-extern "C"
-size_t test(Struct &a,
-			Struct &b,
-			Struct &c,
-			Struct &d,
-			Struct &e) {
-  return a.method(b.method(c.method(d.method(e.method(1)))));
-}
diff --git a/src/test/codegen/static-method-call-multi.rs b/src/test/codegen/static-method-call-multi.rs
deleted file mode 100644
index 025f9b524c9..00000000000
--- a/src/test/codegen/static-method-call-multi.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub struct Struct {
-    field: isize
-}
-
-impl Struct {
-    fn method(&self, x: isize) -> isize {
-        self.field + x
-    }
-}
-
-#[no_mangle]
-pub fn test(a: &Struct,
-            b: &Struct,
-            c: &Struct,
-            d: &Struct,
-            e: &Struct) -> isize {
-    a.method(b.method(c.method(d.method(e.method(1)))))
-}
diff --git a/src/test/codegen/static-method-call.cc b/src/test/codegen/static-method-call.cc
deleted file mode 100644
index 36cfa4f4d84..00000000000
--- a/src/test/codegen/static-method-call.cc
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#include <stdlib.h>
-
-struct Struct {
-  size_t field;
-  size_t method() {
-	return this->field;
-  }
-};
-
-extern "C"
-size_t test(Struct &s) {
-  return s.method();
-}
diff --git a/src/test/codegen/static-method-call.rs b/src/test/codegen/static-method-call.rs
deleted file mode 100644
index fca3784d9e0..00000000000
--- a/src/test/codegen/static-method-call.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub struct Struct {
-    field: isize
-}
-
-impl Struct {
-    fn method(&self) -> isize {
-        self.field
-    }
-}
-
-#[no_mangle]
-pub fn test(s: &Struct) -> isize {
-    s.method()
-}
diff --git a/src/test/codegen/stores.rs b/src/test/codegen/stores.rs
new file mode 100644
index 00000000000..32337b085cd
--- /dev/null
+++ b/src/test/codegen/stores.rs
@@ -0,0 +1,45 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -C no-prepopulate-passes
+
+pub struct Bytes {
+  a: u8,
+  b: u8,
+  c: u8,
+  d: u8,
+}
+
+// CHECK-LABEL: small_array_alignment
+// The array is stored as i32, but its alignment is lower, go with 1 byte to avoid target
+// dependent alignment
+#[no_mangle]
+pub fn small_array_alignment(x: &mut [i8; 4]) {
+// CHECK: [[VAR:%[0-9]+]] = load [4 x i8]** %x
+// CHECK: [[VAR2:%[0-9]+]] = bitcast [4 x i8]* [[VAR]] to i32*
+// CHECK: store i32 %{{.*}}, i32* [[VAR2]], align 1
+    *x = [0; 4];
+}
+
+// CHECK-LABEL: small_struct_alignment
+// The struct is stored as i32, but its alignment is lower, go with 1 byte to avoid target
+// dependent alignment
+#[no_mangle]
+pub fn small_struct_alignment(x: &mut Bytes) {
+// CHECK: [[VAR:%[0-9]+]] = load %Bytes** %x
+// CHECK: [[VAR2:%[0-9]+]] = bitcast %Bytes* [[VAR]] to i32*
+// CHECK: store i32 %{{.*}}, i32* [[VAR2]], align 1
+    *x = Bytes {
+        a: 0,
+        b: 0,
+        c: 0,
+        d: 0,
+    };
+}
diff --git a/src/test/codegen/virtual-method-call-struct-return.cc b/src/test/codegen/virtual-method-call-struct-return.cc
deleted file mode 100644
index 345f21c5647..00000000000
--- a/src/test/codegen/virtual-method-call-struct-return.cc
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#include <stdlib.h>
-
-struct Stuff {
-  size_t a;
-  double b;
-};
-
-struct Struct {
-  virtual Stuff method() = 0;
-};
-
-extern "C"
-size_t test(Struct &s) {
-  return s.method().a;
-}
diff --git a/src/test/codegen/virtual-method-call-struct-return.rs b/src/test/codegen/virtual-method-call-struct-return.rs
deleted file mode 100644
index ae83409b45f..00000000000
--- a/src/test/codegen/virtual-method-call-struct-return.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub struct Stuff {
-  a: isize,
-  b: f64
-}
-
-pub trait Trait {
-    fn method(&self) -> Stuff;
-}
-
-#[no_mangle]
-pub fn test(t: &Trait) -> isize {
-    t.method().a
-}
diff --git a/src/test/codegen/virtual-method-call.cc b/src/test/codegen/virtual-method-call.cc
deleted file mode 100644
index 9fcafdf6594..00000000000
--- a/src/test/codegen/virtual-method-call.cc
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#include <stdlib.h>
-
-struct Struct {
-  virtual size_t method() = 0;
-};
-
-extern "C"
-size_t test(Struct &s) {
-  return s.method();
-}
diff --git a/src/test/codegen/virtual-method-call.rs b/src/test/codegen/virtual-method-call.rs
deleted file mode 100644
index 9bfeef1f018..00000000000
--- a/src/test/codegen/virtual-method-call.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub trait Trait {
-    fn method(&self) -> isize;
-}
-
-#[no_mangle]
-pub fn test(t: &Trait) -> isize {
-    t.method()
-}