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]

Re: [RFC] Confusing fall through BB pc in conditional jump


Hi Segher,

Thanks a lot for the comments.

on 2019/6/28 上午9:32,  wrote:
> Hi Kewen,
> 
> On Thu, Jun 27, 2019 at 10:32:18AM +0800, Kewen.Lin wrote:
>>     6: NOTE_INSN_BASIC_BLOCK 2
>> 	....
>>    12: r135:CC=cmp(r122:DI,0)
>>    13: pc={(r135:CC!=0)?L52:pc}
>>       REG_DEAD r135:CC
>>       REG_BR_PROB 1041558836
>>    31: L31:
>>    17: NOTE_INSN_BASIC_BLOCK 3
>>
>> The above RTL seq is from pass doloop dumping with -fdump-rtl-all-slim, I misunderstood that:
>> the fall through BB of BB 2 is BB 3, since BB 3 is placed just next to BB 2.  
>> Then I found the contradiction that BB 3 will have some uninitialized regs if it's true.
>>
>> I can get the exact information with "-blocks" dumping and even detailed one with "-details".
>> But I'm thinking whether it's worth to giving some information on "-slim" dump (or more 
>> exactly without "-blocks") to avoid some confusion especially for new comers like me.
>> Or is it unnecessary? since we have "-blocks" options for that and want to keep it "slim"?
> 
> It's probably a good idea to spend a line on this even in slim mode, it's
> really easy to miss and get confused and waste time without it.  Nice :-)
> 
>> The dumping will look like:
>>     6: NOTE_INSN_BASIC_BLOCK 2
>> 	...
>>    12: r135:CC=cmp(r122:DI,0)
>>    13: pc={(r135:CC!=0)?L52:pc}
>>       REG_DEAD r135:CC
>>       REG_BR_PROB 1041558836
>> ;;  pc (fall through) -> L67
>>    31: L31:
>>    17: NOTE_INSN_BASIC_BLOCK 3
> 
> I think it should say the BB number it falls through to.  Is the label
> number (insn number) useful?  Maybe the BB number isn't always printed
> in slim dumps?

OK, to use the label was meant to keep the same as what we print for jump
targets of jump insn.  Yes, I think it's better to use BB number.
I think we can get the BB number from NOTE_INSN_BASIC_BLOCK now, it's 
always printed in slim dumps.

> 
> All this only happens in cfglayout mode btw, you might want to restrict
> this to that: in normal rtl mode fallthrough does fall through to the
> next insn always.

Good idea!

> 
> Maybe slim dumps should always spend a line on showing basic block
> boundaries?  Something visual like maybe
> ; ------------------------------
> or
> ; BB 456 ------------------------------
> or
> ; ------------ falls through to BB 123
> or
> ; ------------ falls through to BB 123
> ; BB 456 ------------------------------
> 

It seems the current NOTE_INSN_BASIC_BLOCK is enough for the beginning?

> I don't use slim dumps much, they lose too much information, but maybe
> that can be fixed :-)

OK, since I haven't got used to lisp format, the slim seems more 
understandable to me.  If it's not used too much, maybe this confusion 
and possible improvement is too trivial.  :)


Thanks,
Kewen

> 
> 
> Segher
> 


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