This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/42720] Problematic condition simplification logic at unswitch-loops pass
- From: "jingyu at google dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Jan 2010 00:21:40 -0000
- Subject: [Bug tree-optimization/42720] Problematic condition simplification logic at unswitch-loops pass
- References: <bug-42720-17567@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #5 from jingyu at google dot com 2010-01-30 00:21 -------
>So the problem is really if (optimize_loop_for_size_p (loop)) . I think you
>need to figure out why that is returning true.
That's because after unswitch-loop, one copy of the loop becomes cold. Let's
look at loop.cpp.
Before switch-loop pass, the loop (inner-most, hot) is
loop {
if (obj != 0) {
... <---- hot!
}
}
In function tree_unswitch_single_loop(),
after "nloop = tree_unswitch_loop (loop, bbs[i], cond)", the loop becomes
if (obj != 0) {
loop { <---- original copy of the loop
if (obj != 0) {
... <--- hot!
}
}
} else { <--- cold! becuase obj==0 is rarely seen
loop { <----- "nloop": a new copy of the loop
if (obj != 0) {
...
}
}
}
nloop becomes a cold loop, but we still want to simplify its condition.
Otherwise, nloop becomes an empty loop in the end.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42720