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: libcall problem during new unroller merge


> Hello,
> 
> during merging new loop unroller, I have encountered the following
> problem (masked on rtlopt branch by other pass):
> 
> Consider loop in that strcmp is called; it is translated into rtl as
> 
> (insn 542 541 543 (nil) (set (reg:SI 236)
>         (mem/s/u:SI (plus:SI (reg:SI 235)
>                 (reg:SI 231)) [9 <variable>.name+0 S4 A32])) -1 (nil)
>     (nil))
> 
> (insn 543 542 544 (nil) (set (mem/f:SI (plus:SI (reg/f:SI 56 virtual-outgoing-args)
>                 (const_int 4 [0x4])) [0 S4 A32])
>         (reg:SI 236)) -1 (nil)
>     (insn_list:REG_LIBCALL 547 (nil)))
> 
> (insn 544 543 545 (nil) (set (reg:SI 237)
>         (mem/f:SI (symbol_ref:SI ("ix86_cpu_string")) [9 ix86_cpu_string+0 S4 A32])) -1 (nil)
>     (nil))
> 
> (insn 545 544 546 (nil) (set (mem/f:SI (reg/f:SI 56 virtual-outgoing-args) [0 S4 A32])
>         (reg:SI 237)) -1 (nil)
>     (nil))
> 
> (call_insn/u 546 545 547 (nil) (set (reg:SI 0 eax)
>         (call (mem:QI (symbol_ref:SI ("strcmp")) [0 S1 A8])
>             (const_int 8 [0x8]))) -1 (nil)
>     (expr_list:REG_EH_REGION (const_int -1 [0xffffffff])
>         (nil))
>     (expr_list (use (mem:BLK (scratch) [0 A8]))
>         (nil)))
> 
> (insn 547 546 548 (nil) (set (reg:SI 238)
>         (reg:SI 0 eax)) -1 (nil)
>     (insn_list:REG_RETVAL 543 (expr_list:REG_EQUAL (expr_list (use (mem:BLK (scratch) [0 A8]))
>                 (expr_list (symbol_ref:SI ("strcmp"))
>                     (expr_list (mem/f:SI (symbol_ref:SI ("ix86_cpu_string")) [9 ix86_cpu_string+0 S4 A32])
>                         (expr_list (mem/s/u:SI (plus:SI (reg:SI 235)
>                                     (reg:SI 231)) [9 <variable>.name+0 S4 A32])
>                             (nil)))))
>             (nil))))
> 
> now first cse pass transforms insn 542 into
> 
> (insn 542 541 543 71 0x402e1108 (set (reg:SI 236 [ <variable>.name ])
>         (mem/s/u:SI (plus:SI (reg:SI 235)
>                 (symbol_ref:SI ("processor_alias_table.2"))) [9 <variable>.name+0 S4 A32])) 38 {*movsi_1} (nil)
>     (nil))
> 
> Reference in REG_EQUAL is not updated; set of reg. 231 disappears.
> 
> Similarily, reg. 235 disappears in global copy propagation (in
> jump bypassing pass), being replaced by other register; again,
> reference in REG_EQUAL is not updated.

I think jump bypassing is guilty here.
In my vision of GCC, CSE should update REG_EQUAL note as well as it
should behave equally to all occurences of given register, but
independently on that no-one should kill the register 235 as long as it
is used by some REG_EQUAL.

How it is possible that copy propagation replaces the destination of
insn?
I wrote part of it and it was always meant to only update the sources,
possibly making insn dead.

Honza


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