[PATCH, tree-ssa] Optimize loop invariant phi defs constants

Christian Bruel christian.bruel@st.com
Thu Jun 5 12:22:00 GMT 2014


Hello,

while checking why a loop snippet like

  for (i = 0; i <= 5000; i++)
    if (b)
      a = 2;
    else
      a = x;

was not optimized in -O2 (unless loop unrolling or loop switching), I
found out that the case was already  partially handled by Richard in
PR43934. So this patch just adds a cost to the phi defs constants to
allow the whole test to be hoisted out of the loop.

Richard, does this seem reasonable and OK for 4.10 ?

bootstrapped/regtested for x86

many thanks

Christian





-------------- next part --------------
A non-text attachment was scrubbed...
Name: inv-imm.patch
Type: text/x-patch
Size: 1813 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20140605/4f090c37/attachment.bin>


More information about the Gcc-patches mailing list