[Bug tree-optimization/89713] Optimize away an empty loop whose finiteness can not be analytically determined

fxue at os dot amperecomputing.com gcc-bugzilla@gcc.gnu.org
Fri Mar 15 02:31:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89713

--- Comment #3 from Feng Xue <fxue at os dot amperecomputing.com> ---
Yes, people seldom write an empty loop in real application. These loops are
always by-products of some loop optimizations, such as loop unswitch and loop
split etc. Pragma does be a means to pass loop information to gcc, but have to
modify existing source.

Actually, iterating an std::map, which is constructed using a tree, even
without doing extra things, could take quite a few cpu cycles, this is
different from a simple integer-index loop. In a real benchmark, an empty
std::map loop occupies more than 6% of total application time.


More information about the Gcc-bugs mailing list