Skip to content

Commit

Permalink
Revert "Ensure llvm doesn't trigger an assert for crazy transmutes"
Browse files Browse the repository at this point in the history
This reverts commit 776c632e2a9a044fd134321a9d561e28994ff3ff.
  • Loading branch information
oli-obk committed May 24, 2018
1 parent 85de4ef commit fb9060a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/librustc_codegen_llvm/mir/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,11 @@ pub fn scalar_to_llvm(cx: &CodegenCx,
&C_usize(cx, ptr.offset.bytes()),
1,
) };
let llval = unsafe { llvm::LLVMConstPtrToInt(llval, llty.to_ref()) };
consts::bitcast(llval, llty)
if layout.value != layout::Pointer {
unsafe { llvm::LLVMConstPtrToInt(llval, llty.to_ref()) }
} else {
consts::bitcast(llval, llty)
}
}
}
}
Expand Down

0 comments on commit fb9060a

Please sign in to comment.