This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

A minor mistake in cse_main?


Hi :
  In function cse_main, gcc processes ebb path by path.
firstly, gcc finds the first bb of path in the reverse post order queue,
plus if the bb is still not visited.
then gcc finds all paths starting with that first bb.

the corresponding code is like:

      do
	{
	  bb = BASIC_BLOCK (rc_order[i++]);
	}
      while (TEST_BIT (cse_visited_basic_blocks, bb->index)
	     && i < n_blocks);                 <---------------i might be
equal to n_blocks at last

      while (cse_find_path (bb, &ebb_data, flag_cse_follow_jumps))
      //...other codes....

But this code might result in unwanted operation. looking into one .cse2 dump
file i've encountered, the paths information like:

;; Following path with 37 sets: 2
;; Following path with 23 sets: 3
;; Following path with 11 sets: 4 5
;; Following path with 9 sets: 6 7 9
deferring rescan insn with uid = 163.
;; Following path with 8 sets: 6 7 8     <---------------basic block 8
first handled here
;; Following path with 19 sets: 10 11
;; Following path with 2 sets: 8           <---------------handled again

Apparently, basic block 8 in the last path has already been
processed(in path 6, 8, 9).
the problem is that both conditions of the do-while statement could be
false, and gcc
does not break out from here.

for more information, the reverse post order (rc_order) for that case
is dumped :
  rc_order [0] = 2
  rc_order [1] = 3
  rc_order [2] = 4
  rc_order [3] = 5
  rc_order [4] = 6
  rc_order [5] = 7
  rc_order [6] = 9
  rc_order [7] = 10
  rc_order [8] = 11
  rc_order [9] = 8                             <---------------- the
last basic block is 8


Seems gcc should break after do-while statement if `i' and `b_blocks' are equal.
Any comments? Thanks.

-- 
Best Regards.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]