public inbox for [email protected]  
help / color / mirror / Atom feed
From: XChy <[email protected]>
To: Daniel Gustafsson <[email protected]>
Cc: [email protected]
Subject: Re: Missed compiler optimization issue in function select_rtable_names_for_explain
Date: Wed, 22 May 2024 21:41:08 +0800
Message-ID: <OS0P286MB01631DCDCB5E5BAE8CB2AFE682EB2@OS0P286MB0163.JPNP286.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <[email protected]>
References: <OS0P286MB016392E0B2017DDB6709A11C82EB2@OS0P286MB0163.JPNP286.PROD.OUTLOOK.COM>
	<[email protected]>
	<OS0P286MB01632009BF9AA52386BA9E4D82EB2@OS0P286MB0163.JPNP286.PROD.OUTLOOK.COM>
	<[email protected]>


在 2024/5/22 18:55, Daniel Gustafsson 写道:
>> I mean that the stores with value "0" after the memset are dead:
>> ```
>>      dpns.subplans = NIL;
>>      dpns.ctes = NIL;
>>      dpns.appendrels = NULL;
>> ```
>> since the memset has written zeroes to the object "dpns", and these members are known to be zero.
> They are known to be zero, but that's not entirely equivalent though is it?
> NIL is defined as ((List *) NULL) and NULL is typically defined as ((void *)
> 0), so sizeof(0) would be the size of an int and sizeof(NULL) would be the size
> of a void pointer.

The type or size doesn't matter here. At IR or assembly level, they are 
all zeroes.

My main point is that "dpns.xxx" are filled with zeroes by the memset 
firstly, and overwriting them with zeroes in the following stores is 
redundant. LLVM cannot remove the redundant overwrites due to the 
initialization order. If we adjust the order of the initialization of 
"dpns.xxx", the compiler can remove such stores.

Does my explanation make sense to you?

Best regards, Hongyu.


reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Missed compiler optimization issue in function select_rtable_names_for_explain
  In-Reply-To: <OS0P286MB01631DCDCB5E5BAE8CB2AFE682EB2@OS0P286MB0163.JPNP286.PROD.OUTLOOK.COM>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox