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 <ebotca...@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 <ebotca...@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