[Bug tree-optimization/18241] [4.0 Regression] linux kernel loop gets miscompiled

giovannibajo at libero dot it gcc-bugzilla@gcc.gnu.org
Mon Nov 1 02:26:00 GMT 2004


------- Additional Comments From giovannibajo at libero dot it  2004-11-01 02:26 -------
The final tree dump of the loop with -O1 -fno-ivopts looks like this:

<L15>:;
  nr = pathp->offset;
  node = pathp->node;
  D.7834 = &node->tags;
  addr.9 = (volatile long int *) ((long unsigned int *) D.7834 + D.7838);
  __asm__ __volatile__("btrl %1,%0":"=m" *addr.9:"dIr" nr);
  D.7823 = node->tags[tag][0];
  if (D.7823 != 0) goto out; else goto <L10>;

<L10>:;
  pathp = pathp - 12B;
  if (pathp->node != 0B) goto <L15>; else goto out;




With IV-OPTS, it is like this:

<L15>:;
  nr = *ivtmp.124;
  node = *((struct radix_tree_node * *) ivtmp.124 + -8B);
  D.7834 = &node->tags;
  addr.9 = (volatile long int *) ((long unsigned int *) D.7834 + D.7838);
  __asm__ __volatile__("btrl %1,%0":"=m" *addr.9:"dIr" nr);
  D.7823 = node->tags[tag][0];
  if (D.7823 != 0) goto out; else goto <L10>;

Invalid sum of incoming frequencies 9667, should be 9550
<L10>:;
  D.7820 = *ivtmp.128;
  ivtmp.124 = ivtmp.124 - 12B;
  ivtmp.128 = ivtmp.128 - 12B;
  if (D.7820 != 0B) goto <L15>; else goto out;


It looks like the end condition is now checked on the pointer BEFORE 
decrementing it, unless I am mistaken.

Zdenek, two questions:

- Aren't ivtmp.128 and ivtmp.124 duplicates?
- Since they behave exactly like pathp, there is a way to at least preserve the 
variable name so that the code is easier to read?


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rakdver at gcc dot gnu dot
                   |                            |org, giovannibajo at libero
                   |                            |dot it


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



More information about the Gcc-bugs mailing list