From mboxrd@z Thu Jan 1 00:00:00 1970 From: kenner@vlsi1.ultra.nyu.edu (Richard Kenner) To: dalej@apple.com Cc: gcc@gcc.gnu.org Subject: Re: how to fix anti-optimization? Date: Fri, 14 Sep 2001 15:27:00 -0000 Message-id: <10109142233.AA00201@vlsi1.ultra.nyu.edu> X-SW-Source: 2001-09/msg00577.html const double Prescale[] = { 3.0, 5.0 }; extern void bar(double, double); void foo () { bar(Prescale[0], Prescale[1]); } With -O1 or higher, gcc substitutes constants 3.0 and 5.0 for the array references. This isn't a win on targets where the extra copies of these constants have to go in memory; you get an extra copy of the constants in data space. Only if it's no more complex an expression. Consider Prescale[0]*Prescale[1]. It's *much* faster to do the folding in that case.