Skip to content

Commit

Permalink
Remove dummy value locals for function ptr calls
Browse files Browse the repository at this point in the history
  • Loading branch information
sapir committed Aug 7, 2024
1 parent fb95096 commit 4fe1647
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
self.block
.add_eval(self.location, self.cx.context.new_call(self.location, func, &args));
// Return dummy value when not having return value.
self.context.new_rvalue_from_long(self.isize_type, 0)
self.context.new_rvalue_zero(self.isize_type)
}
}

Expand Down Expand Up @@ -421,17 +421,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
self.cx.context.new_call_through_ptr(self.location, func_ptr, &args),
);
// Return dummy value when not having return value.
let result = current_func.new_local(
self.location,
self.isize_type,
"dummyValueThatShouldNeverBeUsed",
);
self.block.add_assignment(
self.location,
result,
self.context.new_rvalue_from_long(self.isize_type, 0),
);
result.to_rvalue()
self.context.new_rvalue_zero(self.isize_type)
}
}

Expand Down

0 comments on commit 4fe1647

Please sign in to comment.