[Bug ada/46939] New: http://blog.regehr.org/archives/320 example 6

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Dec 14 14:31:00 GMT 2010


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46939

           Summary: http://blog.regehr.org/archives/320 example 6
           Product: gcc
           Version: 4.6.0
               URL: http://blog.regehr.org/archives/320
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jakub@gcc.gnu.org
                CC: hubicka@gcc.gnu.org


The reason we don't expand / 10 using a multiplication is because gcc thinks it
happens in cold code.

In *.optimized we have:
  # BLOCK 5 freq:9999
  # PRED: 4 [100.0%]  (fallthru,exec) 2 [33.3%]  (exec)
  # PT = nonlocal 

  # strD.1584_1 = PHI <strD.1584_17(4), strD.1584_12(D)(2)>
  # signD.1590_5 = PHI <signD.1590_4(4), 0(2)>
<L39>:
  str.0D.2703_18 = (long unsigned intD.4) strD.1584_1;
  end.1D.2704_19 = (long unsigned intD.4) endD.1592_13;
  if (str.0D.2703_18 < end.1D.2704_19)
    goto <bb 6>;
  else
    goto <bb 22>;
  # SUCC: 6 [4.0%]  (true,exec) 22 [96.0%]  (false,exec)

  # BLOCK 6 freq:400
  # PRED: 5 [4.0%]  (true,exec)
  # VUSE <.MEMD.2753_65(D)>
  D.2701_20 = *strD.1584_1;
  if (D.2701_20 > 48)
    goto <bb 7>;
  else
    goto <bb 22>;
  # SUCC: 7 [4.0%]  (true,exec) 22 [96.0%]  (false,exec)

  # BLOCK 7 freq:16
  # PRED: 6 [4.0%]  (true,exec)
  if (D.2701_20 <= 57)
    goto <bb 8>;
  else
    goto <bb 22>;
  # SUCC: 8 [4.0%]  (true,exec) 22 [96.0%]  (false,exec)
...
  # BLOCK 15 freq:6
  # PRED: 14 [96.0%]  (true,exec)
  D.2735_44 = (long intD.2) digitD.1591_43;
  D.2736_45 = 9223372036854775807 - D.2735_44;
  D.2737_46 = D.2736_45 / 10;
  if (ctx_valueD.1589_3 <= D.2737_46)
    goto <bb 16>;
  else
    goto <bb 22>;
  # SUCC: 16 [96.0%]  (true,exec) 22 [4.0%]  (false,exec)

while ((unsigned long) str < (unsigned long) end) is a loop, not sure why we
predict the loop header to terminate immediately, and both the >= 48 and <= 57
tests have return -1; in the other branch, so it is also strange to see them
predicted so unlikely.  Honza?



More information about the Gcc-bugs mailing list