[Bug target/80517] [missed optimization] constant propagation through Intel intrinsics

glisse at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jan 11 16:27:00 GMT 2019


--- Comment #5 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Matthias Kretz from comment #3)
> GCC 9 almost resolves this. However, for some reason this extended test case
> is not fully optimized: https://gcc.godbolt.org/z/jRrHth
> i.e. the call to dont_call_me() should be eliminated as dead code

We are left with:

_GLOBAL__sub_I__Z1fv ()
  <bb 2> [local count: 1073741824]:
  d = 125;


f ()
  unsigned int d.1_1;

  <bb 2> [local count: 1073741824]:
  d.1_1 = d;
  if (d.1_1 == 125)

This is a classic, if the initialization of global variables is only noticed to
be constant after optimizations (as opposed to in the front-end), gcc doesn't
manage to turn the dynamic initialization into a static one. Making the
intrinsics constexpr may help, but really this is something that would be nice
to fix eventually, there are several PRs blocked by this.

More information about the Gcc-bugs mailing list