https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69042
--- Comment #3 from amker at gcc dot gnu.org --- (In reply to amker from comment #2) > For iv use: > use 0 > address > in statement _9 = indexes[i_23]; > > at position indexes[i_23] > type const int * > base (const int *) (&indexes + 4) > step 4 > base object (void *) &indexes > related candidates > > Before the change, two candidates are added: > candidate 8 > var_before ivtmp.12 > var_after ivtmp.12 > incremented before exit test > type unsigned int > base (unsigned int) (&indexes + 4) > step 4 > base object (void *) &indexes > candidate 10 > var_before ivtmp.14 > var_after ivtmp.14 > incremented before exit test > type unsigned int > base (unsigned int) &indexes > step 4 > base object (void *) &indexes > After the change only candidate 8 is added. I did this to minimize the > number of candidates. Maybe that's too aggressive. Probably candidate like > this (with offset stripped) should be added, I will check if it causes new > regressions. > > Another problem is candidate 8 could be chosen to decrease register > pressure, but isn't. I will check why the register pressure cost doesn't > work in this case. Though candidate 8 is still a little bit worse than > candidate 10, because of one more setup instruction in loop pre-header block. For this register pressure question. GCC assumes that symbol "indexes" in memory reference "MEM[symbol: indexes, index: _21, step: 4, offset: 0B]" doesn't introduce any register pressure because we can use addressing mode like "indexes(,%eax,4)". This is not true for pic/pie code. In such case, we need to move "indexes@GOT(%eax)" to a register before using it in memory reference. That's why the additional register use not counted in register pressure computation in IVOPT.