Commit Graph

191 Commits

Author SHA1 Message Date
Michael Woerister 65ff4141a5 Allow the linker to choose the LTO-plugin (which is useful when using LLD) 2018-07-03 16:33:11 +02:00
Pietro Albini b69058daa6
Rollup merge of #51982 - michaelwoerister:hash-modules-properly, r=nikomatsakis
incr.comp.: Take names of children into account when computing the ICH of a module's HIR.

Fixes #40876. Red-green tracking does not make this a problem anymore. We should verify this via a perf-run though.

r? @nikomatsakis
2018-07-03 11:31:10 +02:00
Michael Woerister 79d8d087a3 incr.comp.: Take names of children into account when computing the ICH of a module's HIR. 2018-07-02 16:21:34 +02:00
est31 3779a4cb74 Emit column info in debuginfo for non msvc like targets 2018-07-02 12:16:05 +02:00
bors 96b47337d9 Auto merge of #51828 - kennytm:no-simd-swap-for-mac, r=alexcrichton
Do not allow LLVM to increase a TLS's alignment on macOS.

This addresses the various TLS segfault on macOS 10.10.

Fix #51794.
Fix #51758.
Fix #50867.
Fix #48866.
Fix #46355.
Fix #44056.
2018-06-30 14:00:24 +00:00
kennytm e3d113eca9
Do not allow LLVM to increase a TLS's alignment on macOS. 2018-06-30 21:36:03 +08:00
Vadim Petrochenkov 9f92fce77c Fortify dummy span checking 2018-06-30 01:53:32 +03:00
Oliver Schneider 4bb9648b27 Merge `ConstVal` and `ConstValue` 2018-06-28 11:04:25 +02:00
Oliver Schneider 05994779ea Move everything over from `middle::const_val` to `mir::interpret` 2018-06-28 11:02:31 +02:00
Oliver Schneider 6005b0ad2f Move the Lrc outside the error type and name the fields 2018-06-28 11:01:35 +02:00
John Kåre Alsaker 14d3c6e8f4 Make opaque::Encoder append-only and make it infallible 2018-06-27 11:43:15 +02:00
varkor 82803fd9bd Add backticks to E0558 2018-06-24 00:16:10 +01:00
kennytm a39d93d899
Rollup merge of #51666 - marco-c:disable_probestack, r=nagisa
Disable probestack when GCOV profiling is being used

If I compile Firefox with gcov profiling enabled, Firefox crashes at startup because of probestack.
Since it's disabled for PGO, I think it makes sense to disable it for gcov too.
2018-06-22 16:50:44 +08:00
Marco Castelluccio e9aacfd5c1 Disable probestack when GCOV profiling is being used 2018-06-20 22:07:55 +01:00
Bastien Orivel c863049225 Fix tidy 2018-06-20 19:28:27 +02:00
Bastien Orivel 677eeaaa61 Replace tempdir by tempfile in librustc_trans 2018-06-20 19:28:27 +02:00
bors fc19590297 Auto merge of #51248 - fabric-and-ink:newtype_index_debrujin, r=nikomatsakis
Declare DebruijnIndex via newtype_index macro

Part of #49887

Declare `DebruijnIndex` via the `newtype_index` macro.
2018-06-18 23:14:50 +00:00
bors ae46aefd5b Auto merge of #51594 - eddyb:issue-51582, r=nagisa
rustc_codegen_llvm: don't treat i1 as signed, even for #[repr(i8)] enums.

Fixes #51582. r? @nagisa cc @nox @oli-obk
2018-06-16 21:48:31 +00:00
Eduard-Mihai Burtescu 25c47a4885 rustc_codegen_llvm: don't treat i1 as signed, even for #[repr(i8)] enums. 2018-06-16 16:00:53 +03:00
Fabian Drinck 0ad3600700 Declare DebruijnIndex via newtype_index macro 2018-06-14 18:44:36 +02:00
Eduard-Mihai Burtescu 5a5c7ded0d rustc: rename ty::maps to ty::query. 2018-06-14 18:05:12 +03:00
Nikita Popov 22cf833dd1 Rename -Z no-verify to -Z verify-llvm-ir
This disables IR verification by default.
2018-06-12 21:23:06 +02:00
Nikita Popov 78a16443a3 Respect -Z no-verify during LTO
Currently -Z no-verify only controls IR verification prior to
LLVM codegen, while verification is performed unconditionally
both before and after linking with (Thin)LTO.
2018-06-12 20:50:21 +02:00
Oliver Schneider 5c0d1355f2 Refactor the const eval diagnostic API 2018-06-05 20:49:46 +02:00
Mark Simulacrum e7ae1b2648
Rollup merge of #51323 - nikic:switch-int-lowering, r=nagisa
Generate br for all two target SwitchInts

Instead of only for booleans. This means that `if let` also becomes a br.

Apart from making the IR slightly simpler, this is supported by FastISel (#4353).
2018-06-03 18:18:05 -06:00
Nikita Popov 4f4f7dfc00 Generate br for all two target SwitchInts
Instead of only for booleans. This means that if let also becomes
a br.

Apart from making the IR slightly simpler, this is supported by
FastISel.
2018-06-02 22:21:01 +02:00
bors 4ecf12bf0e Auto merge of #51063 - mixi:musl-bootstrap, r=alexcrichton
Fix building rustc on and for musl hosts.

This fixes all problems I had when trying to compile rustc on a musl-based distribution (with `crt-static = false` in `config.toml`).

This is a fixed version of what ended up being #50105, making it possible to compile rustc on musl targets.

The differences to the old (now merged and subsequently reverted) pull request are:
 - The commit (6d9154a830) that caused the regression for which the original commits were reverted in #50709 is left out. This means the corresponding bug #36710 is still not fixed with `+crt-static`.
 - The test for issue 36710 is skipped for musl targets (until the issue is properly fixed).
 - Building cargo-vendor if `crt-static = false` is needed was broken (cargo-vendor links to some shared libraries if they exist on the system and this produces broken binaries with `+crt-static`)

CC @alexcrichton
2018-06-02 15:26:26 +00:00
Johannes Nixdorf bf3b8df697 musl: don't use the included startfiles with -crt-static
This fixes (only for -crt-static) #36710.
2018-05-31 12:01:50 +02:00
Eduard-Mihai Burtescu 06d88cda08 rustc: rename mir::LocalDecl's syntactic_source_info to source_info. 2018-05-30 20:30:10 +03:00
Eduard-Mihai Burtescu 6c53972478 rustc: turn mir::LocalDecl's visibility_source_info into a SourceScope. 2018-05-30 20:30:10 +03:00
Eduard-Mihai Burtescu 0895590c53 rustc: rename mir::LocalDecl's source_info to visibility_source_info. 2018-05-30 20:30:10 +03:00
Eduard-Mihai Burtescu 85d44c4276 rustc: rename mir::VisibilityScope to mir::SourceScope. 2018-05-30 20:30:09 +03:00
Felix S. Klock II 24abe6f363 rust-lang/rust#27282: Add `StatementKind::ReadForMatch` to MIR.
(This is just the data structure changes and some boilerplate match
code that followed from it; the actual emission of these statements
comes in a follow-up commit.)
2018-05-29 23:01:36 +02:00
bors 5ae5361cdd Auto merge of #50475 - csmoe:debr, r=nikomatsakis
Refactor DebruijnIndex to be 0-based

Fixes #49813
2018-05-29 01:11:24 +00:00
Niko Matsakis 8bd4bffe50 stop invoking `DebruijnIndex::new` directly
Co-authored-by: csmoe <35686186+csmoe@users.noreply.github.com>
2018-05-28 19:47:04 -04:00
bors 2612bbcba0 Auto merge of #50521 - gnzlbg:simd_float, r=alexcrichton
Add simd math intrinsics and gather/scatter

This PR adds simd math intrinsics for floating-point vectors (sqrt, sin, cos, pow, exp, log, fma, abs, etc.) and the generic simd gather/scatter intrinsics.
2018-05-28 16:54:44 +00:00
bors 1e504d301c Auto merge of #51072 - petrochenkov:ifield, r=eddyb
Use `Ident`s for fields in HIR

Continuation of https://github.com/rust-lang/rust/pull/49718, part of https://github.com/rust-lang/rust/issues/49300
2018-05-26 16:56:22 +00:00
Vadim Petrochenkov 189c0a1297 Use `Ident`s for fields in HIR 2018-05-26 14:41:58 +03:00
bors b4247d45a5 Auto merge of #51041 - alexcrichton:better-unwind, r=nikomatsakis
std: Ensure OOM is classified as `nounwind`

OOM can't unwind today, and historically it's been optimized as if it can't
unwind. This accidentally regressed with recent changes to the OOM handler, so
this commit adds in a codegen test to assert that everything gets optimized away
after the OOM function is approrpiately classified as nounwind

Closes #50925
2018-05-26 09:59:43 +00:00
bors 67d99d91e5 Auto merge of #51035 - oli-obk:unsupported_crate_type, r=eddyb
Don't ICE if crate has no valid crate types left

fixes #50993
2018-05-26 03:22:39 +00:00
Alex Crichton f67453729c std: Ensure OOM is classified as `nounwind`
OOM can't unwind today, and historically it's been optimized as if it can't
unwind. This accidentally regressed with recent changes to the OOM handler, so
this commit adds in a codegen test to assert that everything gets optimized away
after the OOM function is approrpiately classified as nounwind

Closes #50925
2018-05-24 12:03:05 -07:00
Oliver Schneider fb9060ac06 Revert "Ensure llvm doesn't trigger an assert for crazy transmutes"
This reverts commit 776c632e2a9a044fd134321a9d561e28994ff3ff.
2018-05-24 20:49:38 +02:00
Oliver Schneider ca8c27e1c1 Ensure llvm doesn't trigger an assert for crazy transmutes 2018-05-24 20:49:38 +02:00
Oliver Schneider c420531304 Replace `ScalarKind` with `Primitive` 2018-05-24 20:49:37 +02:00
Oliver Schneider f82256e473 primval -> scalar rename 2018-05-24 20:49:37 +02:00
Oliver Schneider 64a75ecc80 change `Value::Bytes` to `Value::Bits` 2018-05-24 20:49:37 +02:00
Oliver Schneider d7324631ae Rename MemoryPointer to Pointer 2018-05-24 20:48:54 +02:00
Oliver Schneider 03a92b61ec Eliminate the `Pointer` wrapper type 2018-05-24 20:48:13 +02:00
Oliver Schneider 6436de89fe Differentiate between interpret::Scalar and layout::Scalar 2018-05-24 20:47:35 +02:00
Oliver Schneider ef2177cffc Rename ByVal(Pair) to Scalar(Pair) 2018-05-24 20:47:35 +02:00
Oliver Schneider 1606e137e7 Rename PrimVal to Scalar 2018-05-24 20:47:35 +02:00
Oliver Schneider 9cc5d927c9 Add constant for `Size::from_bytes(0)` 2018-05-24 20:46:07 +02:00
Oliver Schneider dcbe09e2b5 Don't ICE if crate has no valid crate types left 2018-05-24 17:05:16 +02:00
gnzlbg c803ee455b refactor 2018-05-24 16:04:39 +02:00
gnzlbg 1bd9573c1f enable fast-math flags 2018-05-24 16:04:39 +02:00
gnzlbg 7a6a23d818 fix tidy 2018-05-24 16:04:39 +02:00
gnzlbg f8f204c0bf add simd float intrinsics and gather/scatter 2018-05-24 16:04:39 +02:00
bors d022dd48cc Auto merge of #51023 - kennytm:rollup, r=kennytm
Rollup of 9 pull requests

Successful merges:

 - #50864 (Add NetBSD/arm target specs)
 - #50956 (rust-gdb: work around the re-used -d argument in cgdb)
 - #50964 (Make sure that queries have predictable symbol names.)
 - #50965 (Update LLVM to pull in another wasm fix)
 - #50972 (Add -Z no-parallel-llvm flag)
 - #50979 (Fix span for type-only arguments)
 - #50981 (Shrink `LiveNode`.)
 - #50995 (move type out of unsafe block)
 - #51011 ( rustdoc: hide macro export statements from docs)

Failed merges:
2018-05-24 12:05:47 +00:00
bors a76bff86e6 Auto merge of #50949 - eddyb:debuginfo, r=mw
rustc_codegen_llvm: remove some debuginfo cruft.

(The second commit passes tests locally but might not on older LLVM versions)

r? @nikomatsakis
2018-05-24 09:27:15 +00:00
kennytm e14bc2d3d4
Rollup merge of #50972 - nikic:no-parallel, r=michaelwoerister
Add -Z no-parallel-llvm flag

Codegen issues commonly only manifest under specific circumstances,
e.g. if multiple codegen units are used and ThinLTO is enabled.
However, these configuration are threaded, making the use of LLVM
debugging facilities hard, as output is interleaved.

This patch adds a -Z no-parallel-llvm flag, which allows disabling
parallelization of codegen and linking, while otherwise preserving
behavior with regard to codegen units and LTO.
2018-05-24 16:02:41 +08:00
Nikita Popov 54f0668a10 Add -Z no-parallel-llvm flag
Codegen issues commonly only manifest under specific circumstances,
e.g. if multiple codegen units are used and ThinLTO is enabled.
However, these configuration are threaded, making the use of LLVM
debugging facilities hard, as output is interleaved.

This patch adds a -Z no-parallel-llvm flag, which allows disabling
parallelization of codegen and linking, while otherwise preserving
behavior with regard to codegen units and LTO.
2018-05-22 19:23:40 +02:00
Michael Woerister 3ed23a4bd0 Use SortedMap instead of BTreeMap for relocations in MIRI. 2018-05-22 16:54:07 +02:00
John Kåre Alsaker ddc54188fb Introduce AllocType which indicates what AllocIds point to 2018-05-22 04:15:29 +02:00
Eduard-Mihai Burtescu da579ef75e rustc_codegen_llvm: remove closure env alloca hack around upvar debuginfo. 2018-05-21 20:39:59 +03:00
Eduard-Mihai Burtescu a8ceab9cd7 rustc_codegen_llvm: remove debuginfo::VariableKind::CapturedVariable. 2018-05-21 20:39:59 +03:00
Eduard-Mihai Burtescu 7e4d8718cb rustc: use intern_* instead of mk_* where possible. 2018-05-21 12:13:19 +03:00
Eduard-Mihai Burtescu 196b2e0d82 rustc: don't call Kind::from directly, use .into() instead. 2018-05-21 12:13:19 +03:00
bors 22c25dd737 Auto merge of #50841 - oli-obk:promote_errors_to_panics, r=eddyb
Don't lint numeric overflows in promoteds in release mode

r? @eddyb

mitigates #50814
2018-05-20 11:13:24 +00:00
bors 21ea121de1 Auto merge of #50803 - varkor:never-transmute-never, r=eddyb
Fix an ICE when attempting to transmute an uninhabited type

Fixes https://github.com/rust-lang/rust/issues/50570.
2018-05-20 00:49:37 +00:00
bors 3ea2491589 Auto merge of #50893 - kennytm:rollup, r=kennytm
Rollup of 8 pull requests

Successful merges:

 - #50531 (Cleanup uses of TypeIdHasher and replace them with StableHasher)
 - #50819 (Fix potential divide by zero)
 - #50827 (Update LLVM to 56c931901cfb85cd6f7ed44c7d7520a8de1edf97)
 - #50829 (CheckLoopVisitor: also visit break expressions)
 - #50854 (in which the unused shorthand field pattern debacle/saga continues)
 - #50858 (Reorder description for snippets in rustdoc documentation)
 - #50883 (Fix warning when building stage0 libcore)
 - #50889 (Update clippy)

Failed merges:
2018-05-19 22:33:57 +00:00
kennytm e1f031e5d4
Rollup merge of #50819 - cjkenn:cjkenn/div-by-zero, r=kennytm
Fix potential divide by zero

This should fix #50761

I had trouble reproducing with the provided code, but looking at the stack trace would indicate that this code is the likely cause. I made a number of assumptions here, because I don't have enough context on how the register size is set:

1. I assumed `rest.unit.size.bytes()` can be 0, and it's ok if it's set to 0 before this function is called
2. I assumed that if `rest.unit.size.bytes()` is 0, that we want `rest_count` to also be 0.
2018-05-20 04:17:41 +08:00
cjkenn ecce274e56 use if let to avoid potential div by zero
remove semicolon -_-

Add rem_bytes to conditional to avoid error when performing mod by 0

Add test file to confirm compilation passes.

Ensure we don't divide or mod by zero in llvm_type. Include test file from issue.
2018-05-19 08:49:54 -07:00
kennytm 9e914cc223
Rollup merge of #50531 - iancormac84:merge-typeidhasher-cleanup, r=michaelwoerister
Cleanup uses of TypeIdHasher and replace them with StableHasher

Fixes #50424

r? @michaelwoerister
2018-05-19 23:40:58 +08:00
Oliver Schneider 7c25aa79c5 Use `Size` instead of `u64` in mir interpretation 2018-05-19 16:38:49 +02:00
Oliver Schneider 6630678428 Go through an allocation when accessing fields of constants 2018-05-19 14:24:24 +02:00
Oliver Schneider 8b99c61701 Ensure that statics are always ByRef 2018-05-19 14:24:24 +02:00
Oliver Schneider 27e710f557 Add a test showing the erroneous promoted bug 2018-05-19 13:10:51 +02:00
bors bdace29de0 Auto merge of #50744 - nikic:mutable-noalias, r=alexcrichton
Emit noalias on &mut parameters by default

This used to be disabled due to LLVM bugs in the handling of
noalias information in conjunction with unwinding. However,
according to #31681 all known LLVM bugs have been fixed by
LLVM 6.0, so it's probably time to reenable this optimization.

-Z no-mutable-noalias is left as an escape-hatch to debug problems
suspected to stem from this change.
2018-05-19 07:42:03 +00:00
bors 8319ef5b78 Auto merge of #50709 - alexcrichton:revert-musl, r=sfackler
Revert #50105 until regression is fixed

Discovered at https://github.com/rust-lang/rust/pull/50105#issuecomment-388630750 it looks like this caused a regression with i686 musl, so let's revert in the meantime while a fix is worked out
2018-05-19 03:10:53 +00:00
bors 37a409177c Auto merge of #50319 - nagisa:align_to, r=alexcrichton
Implement [T]::align_to

Note that this PR deviates from what is accepted by RFC slightly by making `align_offset` to return an offset in elements, rather than bytes. This is necessary to sanely support `[T]::align_to` and also simply makes more sense™. The caveat is that trying to align a pointer of ZST is now an equivalent to `is_aligned` check, rather than anything else (as no number of ZST elements will align a misaligned ZST pointer).

It also implements the `align_to` slightly differently than proposed in the RFC to properly handle cases where size of T and U aren’t co-prime.

Furthermore, a promise is made that the slice containing `U`s will be as large as possible (contrary to the RFC) – otherwise the function is quite useless.

The implementation uses quite a few underhanded tricks and takes advantage of the fact that alignment is a power-of-two quite heavily to optimise the machine code down to something that results in as few known-expensive instructions as possible. Currently calling `ptr.align_offset` with an unknown-at-compile-time `align` results in code that has just a single "expensive" modulo operation; the rest is "cheap" arithmetic and bitwise ops.

cc https://github.com/rust-lang/rust/issues/44488 @oli-obk

As mentioned in the commit message for align_offset, many thanks go to Chris McDonald.
2018-05-18 21:49:38 +00:00
iancormac84 03493941fb Fixed accidental removal of StableHasher declaration. 2018-05-17 19:43:36 -04:00
iancormac84 a8c2332cc8 Removed use of TypeIdHasher in debuginfo and replaced it with StableHasher. Also corrected erroneous mention of TypeIdHasher in implementation of HashStable trait. 2018-05-17 16:41:18 -04:00
Nikita Popov 12308139ec Emit noalias on &mut parameters by default
This used to be disabled due to LLVM bugs in the handling of
noalias information in conjunction with unwinding. However,
according to #31681 all known LLVM bugs have been fixed by
LLVM 6.0, so it's probably time to reenable this optimization.

Noalias annotations will not be emitted by default if either
-C panic=abort (as previously) or LLVM >= 6.0 (new).

-Z mutable-noalias=no is left as an escape-hatch to allow
debugging problems suspected to stem from this change.
2018-05-17 22:27:29 +02:00
Simonas Kazlauskas 6d5bf8b23f Remove the intrinsic for align_offset
Keep only the language item. This removes some indirection and makes
codegen worse for debug builds, but simplifies code significantly, which
is a good tradeoff to make, in my opinion.

Besides, the codegen can be improved even further with some constant
evaluation improvements that we expect to happen in the future.
2018-05-17 23:13:42 +03:00
varkor edad2eff0c Stabilise inclusive_range_methods 2018-05-17 20:58:28 +01:00
Simonas Kazlauskas d45378216b Change align_offset to support different strides
This is necessary if we want to implement `[T]::align_to` and is more
useful in general.

This implementation effort has begun during the All Hands and represents
a month of my futile efforts to do any sort of maths. Luckily, I
found the very very nice Chris McDonald (cjm) on IRC who figured out the
core formulas for me! All the thanks for existence of this PR go to
them!

Anyway… Those formulas were mangled by yours truly into the arcane forms
you see here to squeeze out the best assembly possible on most of the
modern architectures (x86 and ARM were evaluated in practice). I mean,
just look at it: *one actual* modulo operation and everything else is
just the cheap single cycle ops! Admitedly, the naive solution might be
faster in some common scenarios, but this code absolutely butchers the
naive solution on the worst case scenario.

Alas, the result of this arcane magic also means that the code pretty
heavily relies on the preconditions holding true and breaking those
preconditions will unleash the UB-est of all UBs! So don’t.
2018-05-17 22:46:02 +03:00
Alex Crichton 4796871fb7 Revert "musl: don't use the included startfiles with -crt-static"
This reverts commit a5a875d17b.
2018-05-17 10:37:22 -07:00
Alex Crichton 250bff145f Revert "musl: link crt{begin,end}.o from the system compiler"
This reverts commit 6d9154a830.
2018-05-17 10:37:22 -07:00
varkor f90033303b Make sure the type we think is uninhabited actually is 2018-05-17 18:16:59 +01:00
varkor 05067cf99e Fix an ICE when attempting to transmute an uninhabited type 2018-05-17 18:15:24 +01:00
Irina Popa b63d7e2b1c Rename trans to codegen everywhere. 2018-05-17 15:08:30 +03:00