From: Joel Fernandes <joelagnelf@nvidia.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: "Benno Lossin" <lossin@kernel.org>,
linux-kernel@vger.kernel.org, "Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
acourbot@nvidia.com, "Alistair Popple" <apopple@nvidia.com>,
"Timur Tabi" <ttabi@nvidia.com>,
rust-for-linux@vger.kernel.org
Subject: Re: [PATCH] rust: print: Fix issue with rust_build_error
Date: Mon, 22 Sep 2025 15:01:27 -0400 [thread overview]
Message-ID: <20250922190127.GA2462108@joelbox2> (raw)
In-Reply-To: <CANiq72kDkAtYQ6fBb4gPEJqsS10qmXRRZj34gDWqjAQEvmXVPw@mail.gmail.com>
On Sun, Sep 21, 2025 at 11:13:11AM +0200, Miguel Ojeda wrote:
> On Sun, Sep 21, 2025 at 2:45 AM Joel Fernandes <joelagnelf@nvidia.com> wrote:
> >
> > But even if the pointer is a C const pointer, LLVM seems to
> > always want to reload it.
>
> What do you mean by this? I think I mentioned in the other thread that
> a C pointer to const still allows the callee to change the value.
Apologies, indeed a const pointer in C does not mean the pointee cannot be
modified.
I think I somewhat understand the issue but still not fully. MIR optimization
is supposed to optimize away the dead code in build_assert. This is what I
see for "good" cases when things work.
But the information that the data being printed is an immutable reference, is
lost somehow during MIR optimization phase when a printk is involved. Per the
github issue [1], there is likely some provenance information in the immutable
reference to the data, that gets lost during "MIR inlining" optimization. In
other words, this is not an LLVM problem as I was pointing out, but an MIR
optimization problem. Benno/Gary correct me anything I said is wrong.
I guess I still have a few more questions:
1. What is being inlined when we talk about MIR inlining? The print
statement? Constructor to the Argument object? Something else?
2. What does 'noalias' mean in the github report [1], and why would that effect
'MIR inlining'?
3. Why does LLVM inlining still succeed when MIR inlining is disabled? This
has something to do with a new llvm feature Niki referred to in the report.
thanks,
- Joel
[1] https://github.com/rust-lang/rust/issues/146844
next prev parent reply other threads:[~2025-09-22 19:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-20 16:19 [PATCH] rust: print: Fix issue with rust_build_error Joel Fernandes
2025-09-20 19:34 ` Boqun Feng
2025-09-21 0:53 ` Joel Fernandes
2025-09-20 20:09 ` Benno Lossin
2025-09-21 0:45 ` Joel Fernandes
2025-09-21 7:12 ` Benno Lossin
2025-09-21 9:03 ` Benno Lossin
2025-09-22 10:29 ` Gary Guo
2025-09-22 11:25 ` Miguel Ojeda
2025-09-21 9:13 ` Miguel Ojeda
2025-09-22 19:01 ` Joel Fernandes [this message]
2025-09-21 10:46 ` Alice Ryhl
2025-09-22 19:15 ` Joel Fernandes
2025-09-21 20:56 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250922190127.GA2462108@joelbox2 \
--to=joelagnelf@nvidia.com \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=apopple@nvidia.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
--cc=ttabi@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).