From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeffrey A Law To: Oskar Enoksson Cc: egcs@cygnus.com Subject: Re: Optimization Date: Thu, 02 Apr 1998 08:21:00 -0000 Message-id: <6733.891434001@hurl.cygnus.com> References: X-SW-Source: 1998-04/msg00049.html -- Jeff Law (law@cygnus.com) Cygnus Solutions EGCS GNU Compiler System http://www.cygnus.com http://www.cygnus.com/egcs In message you write: > > Hi! I'm working with computational mathematics using c and c++. > > Does g++/gcc have any optimization that brings out constant subexpressions > outside loops? Consider the following: Yes, gcc performs loop invariant code motion. I don't know why the loop invariants are not being hoisted out of the loop for your example. I haven't had the time to look at it. jeff