Skip to content

Commit b421810

Browse files
authored
Unrolled build for #141956
Rollup merge of #141956 - bjorn3:minor_cg_ssa_cleanup, r=oli-obk Remove two trait methods from cg_ssa They are only called by cg_llvm.
2 parents aae43c4 + 2e8401a commit b421810

File tree

7 files changed

+11
-25
lines changed

7 files changed

+11
-25
lines changed

compiler/rustc_codegen_gcc/src/debuginfo.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ impl<'a, 'gcc, 'tcx> DebugInfoBuilderMethods for Builder<'a, 'gcc, 'tcx> {
5252
fn clear_dbg_loc(&mut self) {
5353
self.location = None;
5454
}
55-
56-
fn get_dbg_loc(&self) -> Option<Self::DILocation> {
57-
self.location
58-
}
5955
}
6056

6157
/// Generate the `debug_context` in an MIR Body.

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/debuginfo/mod.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,12 @@ pub(crate) fn finalize(cx: &CodegenCx<'_, '_>) {
147147
}
148148
}
149149

150+
impl<'ll> Builder<'_, 'll, '_> {
151+
pub(crate) fn get_dbg_loc(&self) -> Option<&'ll DILocation> {
152+
unsafe { llvm::LLVMGetCurrentDebugLocation2(self.llbuilder) }
153+
}
154+
}
155+
150156
impl<'ll> DebugInfoBuilderMethods for Builder<'_, 'll, '_> {
151157
// FIXME(eddyb) find a common convention for all of the debuginfo-related
152158
// names (choose between `dbg`, `debug`, `debuginfo`, `debug_info` etc.).
@@ -209,10 +215,6 @@ impl<'ll> DebugInfoBuilderMethods for Builder<'_, 'll, '_> {
209215
}
210216
}
211217

212-
fn get_dbg_loc(&self) -> Option<&'ll DILocation> {
213-
unsafe { llvm::LLVMGetCurrentDebugLocation2(self.llbuilder) }
214-
}
215-
216218
fn insert_reference_to_gdb_debug_scripts_section_global(&mut self) {
217219
gdb::insert_reference_to_gdb_debug_scripts_section_global(self)
218220
}

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/debuginfo.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ pub trait DebugInfoBuilderMethods: BackendTypes {
8181
);
8282
fn set_dbg_loc(&mut self, dbg_loc: Self::DILocation);
8383
fn clear_dbg_loc(&mut self);
84-
fn get_dbg_loc(&self) -> Option<Self::DILocation>;
8584
fn insert_reference_to_gdb_debug_scripts_section_global(&mut self);
8685
fn set_var_name(&mut self, value: Self::Value, name: &str);
8786
}

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)