about summary refs log tree commit diff
path: root/src/test/mir-opt
AgeCommit message (Collapse)AuthorLines
2021-03-27Auto merge of #78618 - workingjubilee:ieee754-fmt, r=m-ou-sebors-1/+1
Add IEEE 754 compliant fmt/parse of -0, infinity, NaN This pull request improves the Rust float formatting/parsing libraries to comply with IEEE 754's formatting expectations around certain special values, namely signed zero, the infinities, and NaN. It also adds IEEE 754 compliance tests that, while less stringent in certain places than many of the existing flt2dec/dec2flt capability tests, are intended to serve as the beginning of a roadmap to future compliance with the standard. Some relevant documentation is also adjusted with clarifying remarks. This PR follows from discussion in https://github.com/rust-lang/rfcs/issues/1074, and closes #24623. The most controversial change here is likely to be that -0 is now printed as -0. Allow me to explain: While there appears to be community support for an opt-in toggle of printing floats as if they exist in the naively expected domain of numbers, i.e. not the extended reals (where floats live), IEEE 754-2019 is clear that a float converted to a string should be capable of being transformed into the original floating point bit-pattern when it satisfies certain conditions (namely, when it is an actual numeric value i.e. not a NaN and the original and destination float width are the same). -0 is given special attention here as a value that should have its sign preserved. In addition, the vast majority of other programming languages not only output `-0` but output `-0.0` here. While IEEE 754 offers a broad leeway in how to handle producing what it calls a "decimal character sequence", it is clear that the operations a language provides should be capable of round tripping, and it is confusing to advertise the f32 and f64 types as binary32 and binary64 yet have the most basic way of producing a string and then reading it back into a floating point number be non-conformant with the standard. Further, existing documentation suggested that e.g. -0 would be printed with -0 regardless of the presence of the `+` fmt character, but it prints "+0" instead if given such (which was what led to the opening of #24623). There are other parsing and formatting issues for floating point numbers which prevent Rust from complying with the standard, as well as other well-documented challenges on the arithmetic level, but I hope that this can be the beginning of motion towards solving those challenges.
2021-03-24RemoveZsts: don't touch unionsErik Desjardins-0/+32
2021-03-23Auto merge of #83177 - erikdesjardins:zstassign, r=oli-obkbors-124/+91
Remove assignments to ZST places instead of marking ZST return place as unused partially reverts #83118 requested by `@tmiasko` in https://github.com/rust-lang/rust/pull/83118#issuecomment-799692574 r? `@oli-obk`
2021-03-22Preserve signed zero on roundtripJubilee Young-1/+1
This commit removes the previous mechanism of differentiating between "Debug" and "Display" formattings for the sign of -0 so as to comply with the IEEE 754 standard's requirements on external character sequences preserving various attributes of a floating point representation. In addition, numerous tests are fixed.
2021-03-22only run RemoveZsts at mir-opt-level 3 and aboveErik Desjardins-16/+40
2021-03-22Auto merge of #79278 - mark-i-m:stabilize-or-pattern, r=nikomatsakisbors-86/+83
Stabilize or_patterns (RFC 2535, 2530, 2175) closes #54883 This PR stabilizes the or_patterns feature in Rust 1.53. This is blocked on the following (in order): - [x] The crater run in https://github.com/rust-lang/rust/pull/78935#issuecomment-731564021 - [x] The resolution of the unresolved questions and a second crater run (https://github.com/rust-lang/rust/pull/78935#issuecomment-735412705) - It looks like we will need to pursue some sort of edition-based transition for `:pat`. - [x] Nomination and discussion by T-lang - [x] Implement new behavior for `:pat` based on consensus (https://github.com/rust-lang/rust/pull/80100). - [ ] An FCP on stabilization EDIT: Stabilization report is in https://github.com/rust-lang/rust/pull/79278#issuecomment-772815177
2021-03-20bless mir-opt testslcnr-44/+44
2021-03-19update testsmark-86/+83
2021-03-18Mark early otherwise optimization unsoundSantiago Pastorino-2/+2
2021-03-17Auto merge of #82122 - bstrie:dep4real, r=dtolnaybors-15/+15
Deprecate `intrinsics::drop_in_place` and `collections::Bound`, which accidentally weren't deprecated Fixes #82080. I've taken the liberty of updating the `since` values to 1.52, since an unobservable deprecation isn't much of a deprecation (even the detailed release notes never bothered to mention these deprecations). As mentioned in the issue I'm *pretty* sure that using a type alias for `Bound` is semantically equivalent to the re-export; [the reference implies](https://doc.rust-lang.org/reference/items/type-aliases.html) that type aliases only observably differ from types when used on unit structs or tuple structs, whereas `Bound` is an enum.
2021-03-16bless testsErik Desjardins-38/+38
2021-03-15bless testsErik Desjardins-184/+127
2021-03-14bless tests (32-bit)Erik Desjardins-25/+17
2021-03-13bless testsErik Desjardins-27/+17
2021-03-13Move ZST check inside UsedLocalsSimon Vandel Sillesen-0/+1
2021-03-13Extend SimplifyLocals to remove ZST writesSimon Vandel Sillesen-37/+11
2021-03-09Deprecate items that accidentally weren't deprecatedbstrie-15/+15
Fixes #82080
2021-03-09Allow calling *const methods on *mut valuesÖmer Sinan Ağacan-0/+116
Fixes #80258
2021-03-06Disable destination propagation on all mir-opt-levelsTomasz Miąsko-147/+255
2021-03-05Bump mir-opt-level from 2 to 3 in testsSantiago Pastorino-5/+5
2021-03-05Bump mir-opt-level from 3 to 4 in testsSantiago Pastorino-9/+9
2021-02-28Remove storage markers if they won't be used during code generationTomasz Miąsko-0/+126
The storage markers constitute a substantial portion of all MIR statements. At the same time, for builds without any optimizations, the storage markers have no further use during and after MIR optimization phase. If storage markers are not necessary for code generation, remove them.
2021-02-22New mir-opt pass to simplify gotos with const valuesSimon Vandel Sillesen-355/+482
Fixes #77355
2021-02-21New pass to deduplicate blocksSimon Vandel Sillesen-1/+115
2021-02-21Make MatchBranchSimplification clean up after itselfSimon Vandel Sillesen-246/+222
2021-02-14Apply suggestionsBenoît du Garreau-63/+95
- Move `assert_failed` to core::panicking` - Make `assert_failed` use an enum instead of a string
2021-02-14Apply suggestionBenoît du Garreau-7/+13
2021-02-14Fix UI tests and merge `assert_eq` and `assert_ne` internal functionsBenoît du Garreau-642/+114
2021-02-06path trimming: ignore type aliasesDan Aloni-31/+31
2021-02-06Rollup merge of #81753 - tmiasko:inline-instruction-set, r=oli-obkMara Bos-0/+146
Never MIR inline functions with a different instruction set
2021-02-04Revert "Simplify unscheduling of drops after moves"Felix S. Klock II-18/+55
This reverts commit b766abc88f78f36193ddefb1079dbc832346b358.
2021-02-04Revert "Use `record_operands_moved` more aggresively"Felix S. Klock II-99/+187
This reverts commit 7f3e8551dde7f14641618cdb8fda2f99ff1d74b6.
2021-02-04Revert "Avoid leaking block expression values"Felix S. Klock II-15/+10
This reverts commit 4fef39113a514bb270f5661a82fdba17d3e41dbb.
2021-02-05Never MIR inline functions with a different instruction setTomasz Miąsko-0/+146
2021-02-01Auto merge of #80851 - m-ou-se:panic-2021, r=petrochenkovbors-320/+320
Implement Rust 2021 panic This implements the Rust 2021 versions of `panic!()`. See https://github.com/rust-lang/rust/issues/80162 and https://github.com/rust-lang/rfcs/pull/3007. It does so by replacing `{std, core}::panic!()` by a bulitin macro that expands to either `$crate::panic::panic_2015!(..)` or `$crate::panic::panic_2021!(..)` depending on the edition of the caller. This does not yet make std's panic an alias for core's panic on Rust 2021 as the RFC proposes. That will be a separate change: https://github.com/rust-lang/rust/pull/80879/commits/c5273bdfb266c35e8eab9413aa8d58d27fdbe114 That change is blocked on figuring out what to do with https://github.com/rust-lang/rust/issues/80846 first.
2021-01-25Implement new panic!() behaviour for Rust 2021.Mara Bos-320/+320
2021-01-25Ignore a test on wasm, because that changes landing padsoli-37/+39
2021-01-23Move test to mir-opt so we actually see that no inlining is happeningoli-0/+108
2021-01-23Prevent query cycles during inliningoli-0/+69
2021-01-18Remove disabled transformation from instcombineTomasz Miąsko-70/+1
2021-01-15Add test for #59352Dániel Buga-0/+121
2021-01-14Auto merge of #79328 - c410-f3r:hir-if, r=matthewjasperbors-464/+421
Reintroduce hir::ExprKind::If Basically copied and paste #59288/https://github.com/rust-lang/rust-clippy/pull/4080 with some modifications. The vast majority of tests were fixed and now there are only a few remaining. Since I am still unable to figure out the missing pieces, any help with the following list is welcome. - [ ] **Unnecessary `typeck` exception**: [Cheated on this one to make CI green.](https://github.com/rust-lang/rust/pull/79328/files#diff-3faee9ba23fc54a12b7c43364ba81f8c5660045c7e1d7989a02a0cee1c5b2051) - [x] **Incorrect span**: [Span should reference `then` and `else` separately.](https://github.com/rust-lang/rust/pull/79328/files#diff-cf2c46e82222ee4b1037a68fff8a1af3c4f1de7a6b3fd798aacbf3c0475abe3d) - [x] **New note regarding `assert!`**: [Modified but not "wrong". Maybe can be a good thing?](https://github.com/rust-lang/rust/pull/79328/files#diff-9e0d7c89ed0224e2b62060c957177c27db43c30dfe3c2974cb6b5091cda9cfb5) - [x] **Inverted report location**: [Modified but not "wrong". Locations were inverted.](https://github.com/rust-lang/rust/pull/79328/files#diff-f637ce7c1f68d523a165aa9651765df05e36c4d7d279194b1a6b28b48a323691) - [x] **`src/test/ui/point-to-type-err-cause-on-impl-trait-return.rs` has weird errors**: [Not sure why this is happening.](https://github.com/rust-lang/rust/pull/79328/files#diff-c823c09660f5b112f95e97e8ff71f1797b6c7f37dbb3d16f8e98bbaea8072e95) - [x] **Missing diagnostic**: [???](https://github.com/rust-lang/rust/pull/79328/files#diff-6b8ab09360d725ba4513933827f9796b42ff9522b0690f80b76de067143af2fc)
2021-01-09Bless profile targetsCaio-17/+12
2021-01-07Reintroduce hir::ExprKind::IfCaio-447/+409
2021-01-04Keep an unoptimized duplicate of `const fn` aroundoli-46/+46
This allows CTFE to reliably detect UB, as otherwise optimizations may hide UB.
2021-01-04Stop optimizing promotedsoli-62/+62
2020-12-29Make forget intrinsic safeTomasz Miąsko-16/+10
2020-12-25Rollup merge of #79999 - hencrice:yenlinc/79799, r=oli-obkDylan DPC-27/+0
Refactored verbose print into a function Also handle Tuple and Array separately, which was not explicitly checked. Fixes #79799.
2020-12-23Addressed feedbacksYenlin Chen-27/+0
Also updated the mir-opt test output files.
2020-12-17Rollup merge of #80040 - tmiasko:always-lower-intrinsics, r=Dylan-DPCGuillaume Gomez-0/+28
Always run intrinsics lowering pass Move intrinsics lowering pass from the optimization phase (where it would not run if -Zmir-opt-level=0), to the drop lowering phase where it runs unconditionally. The implementation of those intrinsics in code generation and interpreter is unnecessary. Remove it.