From: Leon Romanovsky Date: Fri, 15 Jan 2016 15:59:38 +0000 Subject: Re: InfiniBand-ocrdma: Delete unnecessary variable initialisations in 11 functions Message-Id: <20160115155938.GB32346@leon.nu> List-Id: References: <566ABCD9.1060404@users.sourceforge.net> <567EDED5.4040201@users.sourceforge.net> <5697D865.5010507@users.sourceforge.net> <5697DE31.9040309@users.sourceforge.net> <20160115132014.GC30615@leon.nu> <56990733.7000506@users.sourceforge.net> <20160115150935.GA32346@leon.nu> <56990FAC.6000506@users.sourceforge.net> In-Reply-To: <56990FAC.6000506-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: SF Markus Elfring Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Devesh Sharma , Doug Ledford , Hal Rosenstock , Mitesh Ahuja , Sean Hefty , Selvin Xavier , LKML , kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Julia Lawall On Fri, Jan 15, 2016 at 04:26:36PM +0100, SF Markus Elfring wrote: > >> Would you like to clarify any measurable effects around the implementation > >> detail when various variables will only be initialised immediately > >> before they will be read again? > > > > Compiler will drop this variable initialization by itself because > > there are no reads between this variable initialization and write. > > Which compiler variants would you to take into account for such an use case? GCC supported it before 1999 when I saw it first time. My assumption that in 2016 all compilers are doing such optimization now. I would be glad to hear an example of modern compiler which doesn't support this simple optimization. > > > > I recommend you to take a look on the assembly code and ensure it > > by yourself. > > Will any configuration parameters and command arguments become relevant > to improve also a corresponding software comparison? Please suggest us, you are proposing this change, and not me. > > > > The proposed change won't affect performance at all. > > Will unneeded variable assignments be really optimised away by default? Yes > > > By the way: > Will a small source code reduction matter also a bit here? If you are interested in saving space of one latter, you need to take into account git database increase, do you? > > Regards, > Markus