diff options
| author | Oliver Schneider <github35764891676564198441@oli-obk.de> | 2018-05-24 16:19:55 +0200 |
|---|---|---|
| committer | Oliver Schneider <github35764891676564198441@oli-obk.de> | 2018-05-24 20:49:38 +0200 |
| commit | fb9060ac06868d076ac3116f8efabc9745cc599a (patch) | |
| tree | c85a0281098888f424ea904f67bbee3310ba7e7e | |
| parent | 85de4efdd871657af2f42d9e438769278e667374 (diff) | |
| download | rust-fb9060ac06868d076ac3116f8efabc9745cc599a.tar.gz rust-fb9060ac06868d076ac3116f8efabc9745cc599a.zip | |
Revert "Ensure llvm doesn't trigger an assert for crazy transmutes"
This reverts commit 776c632e2a9a044fd134321a9d561e28994ff3ff.
| -rw-r--r-- | src/librustc_codegen_llvm/mir/constant.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/librustc_codegen_llvm/mir/constant.rs b/src/librustc_codegen_llvm/mir/constant.rs index 1fa3fb79e24..ef0bc3ed330 100644 --- a/src/librustc_codegen_llvm/mir/constant.rs +++ b/src/librustc_codegen_llvm/mir/constant.rs @@ -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) + } } } } |
