[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <E0031941-4ADB-4BEC-A913-4E74B88A60CA@zytor.com>
Date: Sat, 19 Oct 2024 17:25:03 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: "Zhuo, Qiuxu" <qiuxu.zhuo@...el.com>,
"Mehta, Sohil" <sohil.mehta@...el.com>,
"Luck, Tony" <tony.luck@...el.com>, "bp@...en8.de" <bp@...en8.de>
CC: "tglx@...utronix.de" <tglx@...utronix.de>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"mingo@...hat.com" <mingo@...hat.com>,
"x86@...nel.org" <x86@...nel.org>,
"linux-edac@...r.kernel.org" <linux-edac@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v2 08/10] x86/mce: Remove the redundant zeroing assignments
On October 19, 2024 1:30:04 AM PDT, "Zhuo, Qiuxu" <qiuxu.zhuo@...el.com> wrote:
>> From: H. Peter Anvin <hpa@...or.com>
>> [...]
>>
>> Keep in mind that usually the compiler will remove redundant assignments,
>> and if they are too obscure for the compiler to discover, they are probably too
>> subtle for programmers to not introduce bugs in the future ...
>
>Thanks, H.Peter.
>
>This is a good tip to quickly check whether a cleanup of removing unnecessary
>assignments changes the function. If there is no difference in the text before and
>after the cleanup, then it's OK. Otherwise, the cleanup probably changes the
>function in an unintended way.
>
>-Qiuxu
>
Yes and no. Deleting things like redundant reinitialization should only be done if it makes the code clearer. You can think of the redundant statements as comments/asserts.
Powered by blists - more mailing lists