This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/19828] [4.0 Regression] LIM is pulling out a pure function even though there is something which can modify global memory
- From: "drow at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Feb 2005 19:27:49 -0000
- Subject: [Bug tree-optimization/19828] [4.0 Regression] LIM is pulling out a pure function even though there is something which can modify global memory
- References: <20050208190328.19828.pinskia@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From drow at gcc dot gnu dot org 2005-02-08 19:27 -------
Here's another related testcase. If you uncomment the store to global_int,
LIM will move only func_const out of the loop. With them both commented
out, however, the pure call gets moved out of the loop. func_other may
modify global memory, though, so the pure call can not be moved.
int func_pure (void) __attribute__ ((pure));
int func_const (void) __attribute__ ((const));
void func_other (int);
int global_int;
int
func_loop (int arg)
{
while (arg--)
{
// global_int = arg;
func_other (func_pure ());
}
}
int
func_loop_2 (int arg)
{
while (arg--)
{
// global_int = arg;
func_other (func_const ());
}
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19828