summaryrefslogtreecommitdiffstats
path: root/src/test/codegen/dst-vtable-align-nonzero.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/codegen/dst-vtable-align-nonzero.rs
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/codegen/dst-vtable-align-nonzero.rs')
-rw-r--r--src/test/codegen/dst-vtable-align-nonzero.rs45
1 files changed, 0 insertions, 45 deletions
diff --git a/src/test/codegen/dst-vtable-align-nonzero.rs b/src/test/codegen/dst-vtable-align-nonzero.rs
deleted file mode 100644
index 14c4c3f30..000000000
--- a/src/test/codegen/dst-vtable-align-nonzero.rs
+++ /dev/null
@@ -1,45 +0,0 @@
-// compile-flags: -O
-
-#![crate_type = "lib"]
-
-// This test checks that we annotate alignment loads from vtables with nonzero range metadata,
-// and that this allows LLVM to eliminate redundant `align >= 1` checks.
-
-pub trait Trait {
- fn f(&self);
-}
-
-pub struct WrapperWithAlign1<T: ?Sized> { x: u8, y: T }
-
-pub struct WrapperWithAlign2<T: ?Sized> { x: u16, y: T }
-
-pub struct Struct<W: ?Sized> {
- _field: i8,
- dst: W,
-}
-
-// CHECK-LABEL: @eliminates_runtime_check_when_align_1
-#[no_mangle]
-pub fn eliminates_runtime_check_when_align_1(
- x: &Struct<WrapperWithAlign1<dyn Trait>>
-) -> &WrapperWithAlign1<dyn Trait> {
- // CHECK: load [[USIZE:i[0-9]+]], {{.+}} !range [[RANGE_META:![0-9]+]]
- // CHECK-NOT: llvm.umax
- // CHECK-NOT: icmp
- // CHECK-NOT: select
- // CHECK: ret
- &x.dst
-}
-
-// CHECK-LABEL: @does_not_eliminate_runtime_check_when_align_2
-#[no_mangle]
-pub fn does_not_eliminate_runtime_check_when_align_2(
- x: &Struct<WrapperWithAlign2<dyn Trait>>
-) -> &WrapperWithAlign2<dyn Trait> {
- // CHECK: [[X0:%[0-9]+]] = load [[USIZE]], {{.+}} !range [[RANGE_META]]
- // CHECK: {{icmp|llvm.umax}}
- // CHECK: ret
- &x.dst
-}
-
-// CHECK: [[RANGE_META]] = !{[[USIZE]] 1, [[USIZE]] 0}