[Bug rtl-optimization/99041] combine creates invalid address which ICEs in decompose_normal_address

2021-02-09 Thread segher at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99041

--- Comment #5 from Segher Boessenkool  ---
(As Jakub said; I'm just slow).

[Bug rtl-optimization/99041] combine creates invalid address which ICEs in decompose_normal_address

2021-02-09 Thread segher at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99041

--- Comment #4 from Segher Boessenkool  ---
combine always asks recog(), so that must have said it is okay?

[Bug rtl-optimization/99041] combine creates invalid address which ICEs in decompose_normal_address

2021-02-09 Thread bergner at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99041

--- Comment #3 from Peter Bergner  ---
(In reply to Jakub Jelinek from comment #2)
> Combiner tries to combine whatever it can and if it matches (and costs
> suggest it is beneficial) it keeps it.
> So, this looks like a target bug to me.
> In particular, mma_assemble_input_operand predicate seems to allow any MEM
> whatsoever as long as it has V16QImode:
> (define_special_predicate "mma_assemble_input_operand"
>   (match_test "(mode == V16QImode
> && (vsx_register_operand (op, mode) || MEM_P (op)))"))
> I don't believe it can allow any, there must be some requirement on what the
> address of the MEM can be, whether a REG + REG, REG + offset etc. and the
> ICE is a proof it is not the case.

Ahh, ok.  I can make that more robust.  Thanks for the pointer!

[Bug rtl-optimization/99041] combine creates invalid address which ICEs in decompose_normal_address

2021-02-09 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99041

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek  ---
Combiner tries to combine whatever it can and if it matches (and costs suggest
it is beneficial) it keeps it.
So, this looks like a target bug to me.
In particular, mma_assemble_input_operand predicate seems to allow any MEM
whatsoever as long as it has V16QImode:
(define_special_predicate "mma_assemble_input_operand"
  (match_test "(mode == V16QImode
&& (vsx_register_operand (op, mode) || MEM_P (op)))"))
I don't believe it can allow any, there must be some requirement on what the
address of the MEM can be, whether a REG + REG, REG + offset etc. and the ICE
is a proof it is not the case.

[Bug rtl-optimization/99041] combine creates invalid address which ICEs in decompose_normal_address

2021-02-09 Thread bergner at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99041

Peter Bergner  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
   Last reconfirmed||2021-02-09

--- Comment #1 from Peter Bergner  ---
This looks like a combine issue.  Before combine, we have:

(insn 124 123 125 3 (set (reg:V2DF 198 [ MEM  [(void *)_75] ])
(mem:V2DF (reg:DI 149 [ ivtmp.49 ]) [0 MEM  [(void *)_75]+0 S16
A8])) "bug.ii":22:67 1130 {vsx_movv2df_64bit}
 (nil))

(insn 125 124 126 3 (set (reg:DI 199)
(plus:DI (reg:DI 142 [ _63 ])
(reg:DI 149 [ ivtmp.49 ]))) "bug.ii":22:67 66 {*adddi3}
 (nil))

(insn 126 125 127 3 (set (reg:V2DF 200 [ MEM  [(void *)_24 + _16 * 1] ])
(mem:V2DF (plus:DI (reg:DI 199)
(reg:DI 197)) [0 MEM  [(void *)_24 + _16 * 1]+0 S16 A8]))
"bug.ii":22:67 1130 {vsx_movv2df_64bit}
 (expr_list:REG_DEAD (reg:DI 199)
(nil)))

(insn 127 126 128 3 (set (reg:OO 138 [ _41 ])
(unspec:OO [
(subreg:V16QI (reg:V2DF 198 [ MEM  [(void *)_75] ]) 0)
(subreg:V16QI (reg:V2DF 200 [ MEM  [(void *)_24 + _16 * 1]
]) 0)
] UNSPEC_MMA_ASSEMBLE)) 2074 {*mma_assemble_pair}
 (expr_list:REG_DEAD (reg:V2DF 200 [ MEM  [(void *)_24 + _16 * 1] ])
(expr_list:REG_DEAD (reg:V2DF 198 [ MEM  [(void *)_75] ])
(nil


After combine, we have:

(note 124 123 125 3 NOTE_INSN_DELETED)

(note 125 124 126 3 NOTE_INSN_DELETED)

(note 126 125 127 3 NOTE_INSN_DELETED)

(insn 127 126 128 3 (set (reg:OO 138 [ _41 ])
(unspec:OO [
(mem:V16QI (reg:DI 149 [ ivtmp.49 ]) [0 MEM  [(void
*)_75]+0 S16 A8])
(mem:V16QI (plus:DI (plus:DI (reg:DI 142 [ _63 ])
(reg:DI 149 [ ivtmp.49 ]))
(reg:DI 197)) [0 MEM  [(void *)_24 + _16 * 1]+0 S16
A8])
] UNSPEC_MMA_ASSEMBLE)) 2074 {*mma_assemble_pair}
 (nil))

That bad address on the 2nd mem then makes it all the way to LRA which
eventually dies when it calls decompose_normal_address on it.

Segher, is combine allowed to create invalid addresses like that and LRA is
supposed to fix it up or is this really a combine issue?