[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250922190127.GA2462108@joelbox2>
Date: Mon, 22 Sep 2025 15:01:27 -0400
From: Joel Fernandes <joelagnelf@...dia.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Cc: Benno Lossin <lossin@...nel.org>, linux-kernel@...r.kernel.org,
Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>, acourbot@...dia.com,
Alistair Popple <apopple@...dia.com>, Timur Tabi <ttabi@...dia.com>,
rust-for-linux@...r.kernel.org
Subject: Re: [PATCH] rust: print: Fix issue with rust_build_error
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@...dia.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
Powered by blists - more mailing lists