Skip to content

Commit e9646fa

Browse files
committed
Remove unused return values from resume and cleanup_ret
Given that these instructions are diverging, not every codegen backend may be able to produce a return value for them.
1 parent 19dd2ec commit e9646fa

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

compiler/rustc_codegen_gcc/src/builder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,15 +1275,15 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
12751275
// TODO(antoyo)
12761276
}
12771277

1278-
fn resume(&mut self, _exn: RValue<'gcc>) -> RValue<'gcc> {
1278+
fn resume(&mut self, _exn: RValue<'gcc>) {
12791279
unimplemented!();
12801280
}
12811281

12821282
fn cleanup_pad(&mut self, _parent: Option<RValue<'gcc>>, _args: &[RValue<'gcc>]) -> Funclet {
12831283
unimplemented!();
12841284
}
12851285

1286-
fn cleanup_ret(&mut self, _funclet: &Funclet, _unwind: Option<Block<'gcc>>) -> RValue<'gcc> {
1286+
fn cleanup_ret(&mut self, _funclet: &Funclet, _unwind: Option<Block<'gcc>>) {
12871287
unimplemented!();
12881288
}
12891289

compiler/rustc_codegen_llvm/src/builder.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -983,8 +983,10 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
983983
}
984984
}
985985

986-
fn resume(&mut self, exn: &'ll Value) -> &'ll Value {
987-
unsafe { llvm::LLVMBuildResume(self.llbuilder, exn) }
986+
fn resume(&mut self, exn: &'ll Value) {
987+
unsafe {
988+
llvm::LLVMBuildResume(self.llbuilder, exn);
989+
}
988990
}
989991

990992
fn cleanup_pad(&mut self, parent: Option<&'ll Value>, args: &[&'ll Value]) -> Funclet<'ll> {
@@ -1001,14 +1003,11 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
10011003
Funclet::new(ret.expect("LLVM does not have support for cleanuppad"))
10021004
}
10031005

1004-
fn cleanup_ret(
1005-
&mut self,
1006-
funclet: &Funclet<'ll>,
1007-
unwind: Option<&'ll BasicBlock>,
1008-
) -> &'ll Value {
1009-
let ret =
1010-
unsafe { llvm::LLVMRustBuildCleanupRet(self.llbuilder, funclet.cleanuppad(), unwind) };
1011-
ret.expect("LLVM does not have support for cleanupret")
1006+
fn cleanup_ret(&mut self, funclet: &Funclet<'ll>, unwind: Option<&'ll BasicBlock>) {
1007+
unsafe {
1008+
llvm::LLVMRustBuildCleanupRet(self.llbuilder, funclet.cleanuppad(), unwind)
1009+
.expect("LLVM does not have support for cleanupret");
1010+
}
10121011
}
10131012

10141013
fn catch_pad(&mut self, parent: &'ll Value, args: &[&'ll Value]) -> Funclet<'ll> {

compiler/rustc_codegen_ssa/src/traits/builder.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -431,15 +431,11 @@ pub trait BuilderMethods<'a, 'tcx>:
431431
num_clauses: usize,
432432
) -> Self::Value;
433433
fn set_cleanup(&mut self, landing_pad: Self::Value);
434-
fn resume(&mut self, exn: Self::Value) -> Self::Value;
434+
fn resume(&mut self, exn: Self::Value);
435435

436436
// These are used only by msvc
437437
fn cleanup_pad(&mut self, parent: Option<Self::Value>, args: &[Self::Value]) -> Self::Funclet;
438-
fn cleanup_ret(
439-
&mut self,
440-
funclet: &Self::Funclet,
441-
unwind: Option<Self::BasicBlock>,
442-
) -> Self::Value;
438+
fn cleanup_ret(&mut self, funclet: &Self::Funclet, unwind: Option<Self::BasicBlock>);
443439
fn catch_pad(&mut self, parent: Self::Value, args: &[Self::Value]) -> Self::Funclet;
444440
fn catch_switch(
445441
&mut self,

0 commit comments

Comments
 (0)