Sink ptrtoint for RMW ops on pointers to cg_llvm
This commit is contained in:
parent
42825768b1
commit
aa6cfb2669
3 changed files with 18 additions and 42 deletions
|
@ -1132,9 +1132,15 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
|
|||
&mut self,
|
||||
op: rustc_codegen_ssa::common::AtomicRmwBinOp,
|
||||
dst: &'ll Value,
|
||||
src: &'ll Value,
|
||||
mut src: &'ll Value,
|
||||
order: rustc_codegen_ssa::common::AtomicOrdering,
|
||||
) -> &'ll Value {
|
||||
// The only RMW operation that LLVM supports on pointers is compare-exchange.
|
||||
if self.val_ty(src) == self.type_ptr()
|
||||
&& op != rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicXchg
|
||||
{
|
||||
src = self.ptrtoint(src, self.type_isize());
|
||||
}
|
||||
unsafe {
|
||||
llvm::LLVMBuildAtomicRMW(
|
||||
self.llbuilder,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue