https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62631

--- Comment #28 from amker at gcc dot gnu.org ---
On hppa 32, the two iv uses are:
use 0
  address
  in statement *p_1 = 0;

  at position *p_1
  type int *
  base p_7
  step 4
  base object (void *) p_7
  related candidates 
use 1
  compare
  in statement if (i_11 <= 99)

  at position 
  type unsigned int
  base i_4(D) + 1
  step 1
  is a biv
  related candidates 
And the BIV/GIV candidates are:
candidate 3 (important)
  original biv
  type int *
  base p_7
  step 4
  base object (void *) p_7
candidate 4 (important)
  ...
candidate 5 (important)
  original biv
  type unsigned int
  base i_4(D)
  step 1

The costs table are:

Candidate costs:
  cand    cost
  0    5
  1    5
  2    5
  3    4
  4    5
  5    4
  6    5
  7    5
Use 0:
  cand    cost    compl.    depends on
  0    1    2    1
  1    1    0    
  2    1    1    1
  3    1    0    
  4    3    2     inv_expr:0
  5    3    2     inv_expr:0
  6    1    1    
  7    19    3     inv_expr:1

Use 1:
  cand    cost    compl.    depends on
  0    4    0     inv_expr:2
  3    3    0     inv_expr:3
  4    0    0    
  5    0    0    
  7    4    1    

It seems cand3 and cand5 have same level cost, but GCC chooses candidate 5 as
below:
Initial set of candidates:
  cost: 9 (complexity 2)
  cand_cost: 4
  cand_use_cost: 3 (complexity 2)
  candidates: 5
   use:0 --> iv_cand:5, cost=(3,2)
   use:1 --> iv_cand:5, cost=(0,0)

While on other targets, cand 3 is selected.

Reply via email to