diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:58 +0000 |
commit | a4b7ed7a42c716ab9f05e351f003d589124fd55d (patch) | |
tree | b620cd3f223850b28716e474e80c58059dca5dd4 /tests/codegen/virtual-function-elimination-32bit.rs | |
parent | Adding upstream version 1.67.1+dfsg1. (diff) | |
download | rustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.tar.xz rustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.zip |
Adding upstream version 1.68.2+dfsg1.upstream/1.68.2+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/codegen/virtual-function-elimination-32bit.rs')
-rw-r--r-- | tests/codegen/virtual-function-elimination-32bit.rs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/codegen/virtual-function-elimination-32bit.rs b/tests/codegen/virtual-function-elimination-32bit.rs new file mode 100644 index 000000000..6f963363a --- /dev/null +++ b/tests/codegen/virtual-function-elimination-32bit.rs @@ -0,0 +1,35 @@ +// compile-flags: -Zvirtual-function-elimination -Clto -O -Csymbol-mangling-version=v0 +// ignore-64bit + +// CHECK: @vtable.0 = {{.*}}, !type ![[TYPE0:[0-9]+]], !vcall_visibility ![[VCALL_VIS0:[0-9]+]] + +#![crate_type = "lib"] + +trait T { + // CHECK-LABEL: ; <virtual_function_elimination_32bit::S as virtual_function_elimination_32bit::T>::used + fn used(&self) -> i32 { + 1 + } + // CHECK-LABEL-NOT: {{.*}}::unused + fn unused(&self) -> i32 { + 2 + } +} + +#[derive(Copy, Clone)] +struct S; + +impl T for S {} + +fn taking_t(t: &dyn T) -> i32 { + // CHECK: @llvm.type.checked.load({{.*}}, i32 12, metadata !"[[MANGLED_TYPE0:[0-9a-zA-Z_]+]]") + t.used() +} + +pub fn main() { + let s = S; + taking_t(&s); +} + +// CHECK: ![[TYPE0]] = !{i32 0, !"[[MANGLED_TYPE0]]"} +// CHECK: ![[VCALL_VIS0]] = !{i64 2} |