Comments (7)
I am not sure that PR fixes this. The replacement of the NullOp would occur after inlining, so we need the function to be a good inlining candidate in the first place in order to have its UbCheck removed. Resolving that was why I wrote #121767, to remove the huge penalty from the call.
We could also special-case the check calls, they already have a special inliner attribute so what's a bit more magic 🙃
from rust.
#121662 seems highly relevant, in that it introduced the monomorphization time branch IIUC
from rust.
#122975 may help, can you try again once that lands?
from rust.
That does look likely to be relevant, at least to the open-coded version; that the version using <Vec<_> as Deref>::deref
isn't inlining likely means that it still won't and thus won't be able to see UbChecks
transition from unknown to constant via inlining.
On the other hand, it somewhat feels like assert_unsafe_precondition!
should be checking cfg!(ub_checks)
"one level" up (e.g. from core::slice
into alloc::vec
) instead of "all the way" up (i.e. out of the sysroot crates); perhaps, in analogy to how overflow checks are handled, it's wanting for a per-function #[rustc_inherit_ub_checks]
instead of a crate-wide configuration? (Although even then, unsafe fn
should probably default to inheriting UB checks configuration.)
from rust.
WG-prioritization assigning priority (Zulip discussion).
@rustbot label -I-prioritize +P-medium
from rust.
I tried this out with my reworked costs in #123179, but it still doesn't inline by default -- it needs the threshold to be raised to -Z inline-mir-hint-threshold=110
to get inlined with those new costs.
Seems like it's right on the edge. On nightly (2024-03-27) it took -Z inline-mir-hint-threshold=105
to inline https://rust.godbolt.org/z/7bK7n4d66, so it's only one instruction away.
from rust.
It was so close to the threshold that a touch of simplification in libcore got it inlining again for you.
PR up: #123190
from rust.
Related Issues (20)
- Unsafe in extern causes bad diagnostic HOT 2
- Achieving Perfection: Reaching Incredible Levels For Our Outstanding Language's Success HOT 3
- Can't use struct with reference to struct with lifetime as GAT HOT 4
- closure rvalue not checked for WF allowing it to assume more implied bounds
- -Zscript doesn't download dependecies HOT 2
- bootstrap fails to find `codegen-backends` folder
- core::iter::ArrayChunks does not return the remainder if None is never yielded HOT 1
- Incorrect line table generation for await points HOT 1
- "use of undeclared crate or module `slice`" on x86_64-unknown-haiku HOT 3
- Not inlining array/slice access and iteration at opt-level=z causes knock-on effects on size HOT 21
- thread 'rustc' panicked at /rustc/1388d7a069d872bcfe5e5dd97ef61fa0a586fac0/compiler/rustc_query_system/src/dep_graph/serialized.rs:190:9: HOT 7
- The `ptr::Pointee` design must incorporate layout info HOT 5
- Segmentation fault in `__llvm_write_binary_ids` using LLVM 17.0.6 HOT 2
- `VecDeque::shrink_to` leads to UB if `handle_alloc_error` unwinds. HOT 9
- rustdoc: ICE: `IndexMap: key not found` HOT 2
- ICE: "no saved object file in work product" - potential incremental issue HOT 12
- ICE: `entered unreachable code: parse_dot_or_call_expr_with_ shouldn't produce this` HOT 1
- Invalid clippy suggestion for `!(a as type >= b)` HOT 2
- Tracking Issue for `context_ext`
- nightly rustdoc on doc.rust-lang.org has broken search and missing colours HOT 26
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust.