I'm not satisfied with the name of "last_wn_current_bb". It looks like a
pointer to BB, not WN.
I'm OK with the rest of this patch.
Another point, the goto-convertion should be able to eliminate this kind of
TRUEBR/FALSEBR but it doesn't. It's a performance issue of goto-convertion.
2011/10/8 Gang Yu <yugang...@gmail.com>
> Hi,
>
> Could a gatekeep please help review on fix for bug869?
> http://bugs.open64.net/show_bug.cgi?id=869
>
> symptom:
>
> opencc builds broken for this case:
>
> int g = 0x10;
> int *volatile h = &g;
>
> int f(){
> while (1)
> if (*h) continue;
> }
> Analysis:
>
> after goto convertion, we get whirl program:
>
> LABEL L1794 0 {line: 0/0}
> U8U8LDID 0 <1,51,h> T<53,anon_ptr.,8,V>
> I4I4ILOAD 0 T<4,.predef_I4,4> T<53,anon_ptr.,8>
> U4INTCONST 0 (0x0)
> I4I4NE
> TRUEBR L514 {line: 1/6}
> LABEL L514 0 {line: 1/6}
> GOTO L1794 {line: 0/0}
> when it goes to the CFG construction phase, the label(L514) bb happens to
> the fallthrough bb of TRUEBR bb(_current_bb), so no real branch case
> generated.
>
> Solution:
>
> Add null bb for this case.
>
> Patch:
>
> --- a/osprey/be/opt/opt_cfg.cxx
> +++ b/osprey/be/opt/opt_cfg.cxx
> @@ -3189,6 +3189,19 @@ CFG::Add_one_stmt( WN *wn, END_BLOCK *ends_bb )
> ("Non-empty block assigned to a label") );
> // if we're trying to add this label to a non-empty block, we
> // need to end the current block, and connect the new one to it
> +
> + // fix bug869(open64.net), check to see whether last statement of
> _current_bb
> + // is OPR_FALSEBR/OPR_TRUEBR, and the statment's label bb is
> label_bb.
> + // if so, add the null fall-through bb and set it be the current
> bb
> + WN* last_wn_current_bb=_current_bb->Laststmt();
> + if (last_wn_current_bb &&
> + (OPCODE_operator(WN_opcode(last_wn_current_bb)) == OPR_FALSEBR
> ||
> + OPCODE_operator(WN_opcode(last_wn_current_bb)) == OPR_TRUEBR)
> &&
> + Get_bb_from_label( WN_label_number(last_wn_current_bb)) ==
> label_bb) {
> + BB_NODE* fall_through_bb= Create_bb();
> + Connect_predsucc(_current_bb,fall_through_bb);
> + Append_bb(fall_through_bb);
> + }
> if ( ! _current_bb->Hasujp() )
> Connect_predsucc( _current_bb, label_bb );
>
>
>
>
>
> Regards
> Gang
>
>
> ------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously valuable.
> Why? It contains a definitive record of application performance, security
> threats, fraudulent activity, and more. Splunk takes this data and makes
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2dcopy2
> _______________________________________________
> Open64-devel mailing list
> Open64-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/open64-devel
>
>
--
Regards,
Lai Jian-Xin
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel