Skip to content

Commit 2e8401a

Browse files
committed
Remove type_test from IntrinsicCallBuilderMethods
It is only used within cg_llvm.
1 parent 00a88b9 commit 2e8401a

File tree

4 files changed

+5
-16
lines changed

4 files changed

+5
-16
lines changed

compiler/rustc_codegen_gcc/src/intrinsic/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -524,11 +524,6 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tc
524524
cond
525525
}
526526

527-
fn type_test(&mut self, _pointer: Self::Value, _typeid: Self::Value) -> Self::Value {
528-
// Unsupported.
529-
self.context.new_rvalue_from_int(self.int_type, 0)
530-
}
531-
532527
fn type_checked_load(
533528
&mut self,
534529
_llvtable: Self::Value,

compiler/rustc_codegen_llvm/src/builder.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,8 +1815,11 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
18151815
let typeid_metadata = self.cx.typeid_metadata(typeid).unwrap();
18161816
let dbg_loc = self.get_dbg_loc();
18171817

1818-
// Test whether the function pointer is associated with the type identifier.
1819-
let cond = self.type_test(llfn, typeid_metadata);
1818+
// Test whether the function pointer is associated with the type identifier using the
1819+
// llvm.type.test intrinsic. The LowerTypeTests link-time optimization pass replaces
1820+
// calls to this intrinsic with code to test type membership.
1821+
let typeid = self.get_metadata_value(typeid_metadata);
1822+
let cond = self.call_intrinsic("llvm.type.test", &[llfn, typeid]);
18201823
let bb_pass = self.append_sibling_block("type_test.pass");
18211824
let bb_fail = self.append_sibling_block("type_test.fail");
18221825
self.cond_br(cond, bb_pass, bb_fail);

compiler/rustc_codegen_llvm/src/intrinsic.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -636,13 +636,6 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
636636
}
637637
}
638638

639-
fn type_test(&mut self, pointer: Self::Value, typeid: Self::Metadata) -> Self::Value {
640-
// Test the called operand using llvm.type.test intrinsic. The LowerTypeTests link-time
641-
// optimization pass replaces calls to this intrinsic with code to test type membership.
642-
let typeid = self.get_metadata_value(typeid);
643-
self.call_intrinsic("llvm.type.test", &[pointer, typeid])
644-
}
645-
646639
fn type_checked_load(
647640
&mut self,
648641
llvtable: &'ll Value,

compiler/rustc_codegen_ssa/src/traits/intrinsic.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ pub trait IntrinsicCallBuilderMethods<'tcx>: BackendTypes {
2222
fn abort(&mut self);
2323
fn assume(&mut self, val: Self::Value);
2424
fn expect(&mut self, cond: Self::Value, expected: bool) -> Self::Value;
25-
/// Trait method used to test whether a given pointer is associated with a type identifier.
26-
fn type_test(&mut self, pointer: Self::Value, typeid: Self::Metadata) -> Self::Value;
2725
/// Trait method used to load a function while testing if it is associated with a type
2826
/// identifier.
2927
fn type_checked_load(

0 commit comments

Comments
 (0)