This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Add simple narrowing optimization to expand_case


On 7/24/19 3:57 AM, Eric Botcazou wrote:
> Hi,
> 
> this adds a simple narrowing optimization to expand_case in order to avoid 
> calling a double-word comparison routine when it is unnecessary to do so.
> This is mainly for -O0 because the optimization is otherwise done by forward 
> propagation and avoids having to drag libgcc or not depending on the -O level.
> 
> Tested on x86_64-suse-linux, OK for the mainline?
> 
> 
> 2019-07-24  Eric Botcazou  <ebotcazou@adacore.com>
> 
> 	* stmt.c (expand_case): Try to narrow the index type if it's larger
> 	than a word.  Tidy up.
> 
> 
> 2019-07-24  Eric Botcazou  <ebotcazou@adacore.com>
> 
> 	* gnat.dg/case_optimization3.ad[sb]: New test.
> 
I wouldn't much care about dragging in libgcc for a -O0 build.  Instead
I'd pitch this as generating sensible code regardless of the
optimization level.

OK by me.

Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]