* [Bug target/65153] sh: "insn does not satisfy its constraints" when compiling libmcrypt
2015-02-21 9:52 [Bug target/65153] New: sh: "insn does not satisfy its constraints" when compiling libmcrypt glaubitz at physik dot fu-berlin.de
@ 2015-02-21 13:46 ` olegendo at gcc dot gnu.org
2015-02-21 14:41 ` glaubitz at physik dot fu-berlin.de
` (14 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: olegendo at gcc dot gnu.org @ 2015-02-21 13:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65153
Oleg Endo <olegendo at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |olegendo at gcc dot gnu.org
--- Comment #1 from Oleg Endo <olegendo at gcc dot gnu.org> ---
(In reply to John Paul Adrian Glaubitz from comment #0)
>
> Full build log can be found in [1]. Attaching the precompiled source file
> ccwCPfub.out.
There are no attachments in this PR. Could you please check again?
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/65153] sh: "insn does not satisfy its constraints" when compiling libmcrypt
2015-02-21 9:52 [Bug target/65153] New: sh: "insn does not satisfy its constraints" when compiling libmcrypt glaubitz at physik dot fu-berlin.de
2015-02-21 13:46 ` [Bug target/65153] " olegendo at gcc dot gnu.org
@ 2015-02-21 14:41 ` glaubitz at physik dot fu-berlin.de
2015-02-21 15:07 ` [Bug target/65153] [SH][4.9 Regression] " olegendo at gcc dot gnu.org
` (13 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: glaubitz at physik dot fu-berlin.de @ 2015-02-21 14:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65153
--- Comment #2 from John Paul Adrian Glaubitz <glaubitz at physik dot fu-berlin.de> ---
Created attachment 34823
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34823&action=edit
Pre-compiled source file for libmcrypt 2.5.8
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/65153] [SH][4.9 Regression] "insn does not satisfy its constraints" when compiling libmcrypt
2015-02-21 9:52 [Bug target/65153] New: sh: "insn does not satisfy its constraints" when compiling libmcrypt glaubitz at physik dot fu-berlin.de
2015-02-21 13:46 ` [Bug target/65153] " olegendo at gcc dot gnu.org
2015-02-21 14:41 ` glaubitz at physik dot fu-berlin.de
@ 2015-02-21 15:07 ` olegendo at gcc dot gnu.org
2015-02-21 15:30 ` olegendo at gcc dot gnu.org
` (12 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: olegendo at gcc dot gnu.org @ 2015-02-21 15:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65153
Oleg Endo <olegendo at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|sh: "insn does not satisfy |[SH][4.9 Regression] "insn
|its constraints" when |does not satisfy its
|compiling libmcrypt |constraints" when compiling
| |libmcrypt
--- Comment #3 from Oleg Endo <olegendo at gcc dot gnu.org> ---
I was able to reproduce the problem on 4.9 branch sh-elf with -m4 -ml -O2
-fPIC.
On trunk (GCC 5) it seems not to happen.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/65153] [SH][4.9 Regression] "insn does not satisfy its constraints" when compiling libmcrypt
2015-02-21 9:52 [Bug target/65153] New: sh: "insn does not satisfy its constraints" when compiling libmcrypt glaubitz at physik dot fu-berlin.de
` (2 preceding siblings ...)
2015-02-21 15:07 ` [Bug target/65153] [SH][4.9 Regression] " olegendo at gcc dot gnu.org
@ 2015-02-21 15:30 ` olegendo at gcc dot gnu.org
2015-02-21 17:07 ` olegendo at gcc dot gnu.org
` (11 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: olegendo at gcc dot gnu.org @ 2015-02-21 15:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65153
Oleg Endo <olegendo at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-02-21
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/65153] [SH][4.9 Regression] "insn does not satisfy its constraints" when compiling libmcrypt
2015-02-21 9:52 [Bug target/65153] New: sh: "insn does not satisfy its constraints" when compiling libmcrypt glaubitz at physik dot fu-berlin.de
` (3 preceding siblings ...)
2015-02-21 15:30 ` olegendo at gcc dot gnu.org
@ 2015-02-21 17:07 ` olegendo at gcc dot gnu.org
2015-02-22 5:18 ` kkojima at gcc dot gnu.org
` (10 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: olegendo at gcc dot gnu.org @ 2015-02-21 17:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65153
Oleg Endo <olegendo at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kkojima at gcc dot gnu.org
--- Comment #4 from Oleg Endo <olegendo at gcc dot gnu.org> ---
(insn 143 142 144 12 (set (reg/v:SI 7 r7 [orig:227 t ] [227])
(ior:SI (reg:SI 1 r1)
(reg:SI 13 r13 [orig:718 D.4992 ] [718]))) cast-256.c:387 130
{*iorsi3_compact}
(expr_list:REG_DEAD (reg:SI 13 r13 [orig:718 D.4992 ] [718])
(nil)))
This is an impossible register allocation for the insn. It allows only 2
different regs but there are 3 different regs assigned. I've seen this
somewhere before ... but I can't recall where. Kaz do you remember anything
like that?
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/65153] [SH][4.9 Regression] "insn does not satisfy its constraints" when compiling libmcrypt
2015-02-21 9:52 [Bug target/65153] New: sh: "insn does not satisfy its constraints" when compiling libmcrypt glaubitz at physik dot fu-berlin.de
` (4 preceding siblings ...)
2015-02-21 17:07 ` olegendo at gcc dot gnu.org
@ 2015-02-22 5:18 ` kkojima at gcc dot gnu.org
2015-02-22 5:20 ` kkojima at gcc dot gnu.org
` (9 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: kkojima at gcc dot gnu.org @ 2015-02-22 5:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65153
--- Comment #5 from Kazumoto Kojima <kkojima at gcc dot gnu.org> ---
Created attachment 34828
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34828&action=edit
reduced testcase
Looks an interesting "why didn't we see it?" target bug.
The problem happens at peephole2 phase. The insn sequence
(insn 353 103 105 4 (set (reg:SI 1 r1) (reg:SI 6 r6)))
(insn 105 353 106 4 (set (reg:SI 7 r7) (ashift:SI (reg:SI 7 r7) (reg:SI 0
r0))))
(insn 106 105 107 4 (set (reg/v:SI 6 r6)
(ior:SI (reg:SI 6 r6) (reg:SI 7 r7))))
is tested by the complex peephole
(define_peephole2
[(set (match_operand 0 "any_register_operand" "")
(match_operand 1 "any_register_operand" ""))
(set (match_operand 2 "any_register_operand" "") (match_operand 3 "" ""))
(set (match_operand 4 "" "") (match_operand 5 "" ""))]
"(HARD_REGNO_NREGS (REGNO (operands[0]), GET_MODE (operands[2]))
<= HARD_REGNO_NREGS (REGNO (operands[0]), GET_MODE (operands[0])))
&& peep2_reg_dead_p (3, operands[0]) && peep2_reg_dead_p (3, operands[2])
&& ! FIND_REG_INC_NOTE (peep2_next_insn (2), operands[0])
&& ! FIND_REG_INC_NOTE (peep2_next_insn (2), operands[2])
&& ! reg_overlap_mentioned_p (operands[0], operands[3])
&& ! reg_overlap_mentioned_p (operands[2], operands[0])
&& ! reg_overlap_mentioned_p (operands[0], operands[1])
&& (REGNO_REG_CLASS (REGNO (operands[0]))
== REGNO_REG_CLASS (REGNO (operands[2])))
&& (REGNO_REG_CLASS (REGNO (operands[1]))
== REGNO_REG_CLASS (REGNO (operands[0])))"
[(set (match_dup 0) (match_dup 3))
(set (match_dup 4) (match_dup 5))]
{
...
This peephole2 in sh.md tries to replace operands[0] with operands[1]
and operands[2] with operands[0] in operands[4]/operands[5]. In our
case, operands[5] is (ior:SI (reg:SI 6 r6) (reg:SI 7 r7)) and the peephole
tries to do term rewriting r1 -> r6, r7 -> r1. This peephole fails
after all and then tries to restore operands[5] with term rewriting
r6 -> r1, r1 -> r7. Unfortunately this can't reverse the first term
rewriting and yields (ior:SI (reg:SI 1 r1) (reg:SI 7 r7)). Thus we
got a wrong insn
(set (reg/v:SI 6 r6) (ior:SI (reg:SI 1 r1) (reg:SI 7 r7))).
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/65153] [SH][4.9 Regression] "insn does not satisfy its constraints" when compiling libmcrypt
2015-02-21 9:52 [Bug target/65153] New: sh: "insn does not satisfy its constraints" when compiling libmcrypt glaubitz at physik dot fu-berlin.de
` (5 preceding siblings ...)
2015-02-22 5:18 ` kkojima at gcc dot gnu.org
@ 2015-02-22 5:20 ` kkojima at gcc dot gnu.org
2015-02-22 14:48 ` olegendo at gcc dot gnu.org
` (8 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: kkojima at gcc dot gnu.org @ 2015-02-22 5:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65153
--- Comment #6 from Kazumoto Kojima <kkojima at gcc dot gnu.org> ---
Created attachment 34831
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34831&action=edit
a possible patch
I think the problem is latent on trunk.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/65153] [SH][4.9 Regression] "insn does not satisfy its constraints" when compiling libmcrypt
2015-02-21 9:52 [Bug target/65153] New: sh: "insn does not satisfy its constraints" when compiling libmcrypt glaubitz at physik dot fu-berlin.de
` (6 preceding siblings ...)
2015-02-22 5:20 ` kkojima at gcc dot gnu.org
@ 2015-02-22 14:48 ` olegendo at gcc dot gnu.org
2015-02-22 23:49 ` olegendo at gcc dot gnu.org
` (7 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: olegendo at gcc dot gnu.org @ 2015-02-22 14:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65153
--- Comment #8 from Oleg Endo <olegendo at gcc dot gnu.org> ---
It seems that the problematic peephole is trying to wallpaper some unlucky
register allocation/reload choices like:
before peephole:
mov.w .L26,r1
add r8,r1
mov r1,r8
mov #0,r1
mov.l r1,@(32,r8)
after peephole:
mov.w .L26,r1
add r8,r1
mov #0,r8
mov.l r8,@(32,r1)
I've tried to disable the peephole on trunk and compared CSiBE results. It
seems the peephole doesn't hit very often:
sum: 3371887 -> 3371943 +56 / +0.001661 %
So we could probably remove the complex peephole without a big loss.
I have a set of similar but simpler peepholes with a higher hit rate. Maybe we
can replace the complex peephole with some simpler ones.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/65153] [SH][4.9 Regression] "insn does not satisfy its constraints" when compiling libmcrypt
2015-02-21 9:52 [Bug target/65153] New: sh: "insn does not satisfy its constraints" when compiling libmcrypt glaubitz at physik dot fu-berlin.de
` (7 preceding siblings ...)
2015-02-22 14:48 ` olegendo at gcc dot gnu.org
@ 2015-02-22 23:49 ` olegendo at gcc dot gnu.org
2015-02-23 0:13 ` kkojima at gcc dot gnu.org
` (6 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: olegendo at gcc dot gnu.org @ 2015-02-22 23:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65153
--- Comment #9 from Oleg Endo <olegendo at gcc dot gnu.org> ---
(In reply to Oleg Endo from comment #8)
>
> I've tried to disable the peephole on trunk and compared CSiBE results. It
> seems the peephole doesn't hit very often:
> sum: 3371887 -> 3371943 +56 / +0.001661 %
>
> So we could probably remove the complex peephole without a big loss.
>
> I have a set of similar but simpler peepholes with a higher hit rate. Maybe
> we can replace the complex peephole with some simpler ones.
The set of peepholes can be found in PR 61142, attachment 34839.
CSiBE numbers with that patch:
sum: 3371887 -> 3367967 -3920 / -0.116255 %
avg: -217.777778 / -0.167780 %
max: replaypc-0.4.0.preproc 57212 -> 57188 -24 / -0.041949 %
min: mpeg2dec-0.3.1 54348 -> 53984 -364 / -0.669758 %
and with the patch, but without the problematic peephole of this PR:
sum: 3371887 -> 3367983 -3904 / -0.115781 %
avg: -216.888889 / -0.167686 %
max: replaypc-0.4.0.preproc 57212 -> 57188 -24 / -0.041949 %
min: mpeg2dec-0.3.1 54348 -> 53984 -364 / -0.669758 %
It seems that the other set of peepholes covers most of the cases of the
complex peephole.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/65153] [SH][4.9 Regression] "insn does not satisfy its constraints" when compiling libmcrypt
2015-02-21 9:52 [Bug target/65153] New: sh: "insn does not satisfy its constraints" when compiling libmcrypt glaubitz at physik dot fu-berlin.de
` (8 preceding siblings ...)
2015-02-22 23:49 ` olegendo at gcc dot gnu.org
@ 2015-02-23 0:13 ` kkojima at gcc dot gnu.org
2015-02-23 1:19 ` olegendo at gcc dot gnu.org
` (5 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: kkojima at gcc dot gnu.org @ 2015-02-23 0:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65153
--- Comment #10 from Kazumoto Kojima <kkojima at gcc dot gnu.org> ---
The new peepholes are fine for trunk even in the stage4 but a bit
invasive to the release branch. For 4.9 branch, I'd like to simply
remove the problematic peephole.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/65153] [SH][4.9 Regression] "insn does not satisfy its constraints" when compiling libmcrypt
2015-02-21 9:52 [Bug target/65153] New: sh: "insn does not satisfy its constraints" when compiling libmcrypt glaubitz at physik dot fu-berlin.de
` (9 preceding siblings ...)
2015-02-23 0:13 ` kkojima at gcc dot gnu.org
@ 2015-02-23 1:19 ` olegendo at gcc dot gnu.org
2015-02-23 8:19 ` kkojima at gcc dot gnu.org
` (4 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: olegendo at gcc dot gnu.org @ 2015-02-23 1:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65153
--- Comment #11 from Oleg Endo <olegendo at gcc dot gnu.org> ---
Sure. I was actually referring to trunk all the time :)
I agree to remove the problematic peephole on 4.9 branch.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/65153] [SH][4.9 Regression] "insn does not satisfy its constraints" when compiling libmcrypt
2015-02-21 9:52 [Bug target/65153] New: sh: "insn does not satisfy its constraints" when compiling libmcrypt glaubitz at physik dot fu-berlin.de
` (10 preceding siblings ...)
2015-02-23 1:19 ` olegendo at gcc dot gnu.org
@ 2015-02-23 8:19 ` kkojima at gcc dot gnu.org
2015-02-23 10:58 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: kkojima at gcc dot gnu.org @ 2015-02-23 8:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65153
--- Comment #12 from Kazumoto Kojima <kkojima at gcc dot gnu.org> ---
Created attachment 34840
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34840&action=edit
patch for 4_9-branch
I've noticed that that peephole is the last user of sh.c:replace_n_hard_rtx.
I'm testing this and the similar patch for trunk on sh4-unknown-linux-gnu.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/65153] [SH][4.9 Regression] "insn does not satisfy its constraints" when compiling libmcrypt
2015-02-21 9:52 [Bug target/65153] New: sh: "insn does not satisfy its constraints" when compiling libmcrypt glaubitz at physik dot fu-berlin.de
` (11 preceding siblings ...)
2015-02-23 8:19 ` kkojima at gcc dot gnu.org
@ 2015-02-23 10:58 ` rguenth at gcc dot gnu.org
2015-02-25 5:45 ` kkojima at gcc dot gnu.org
` (2 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-02-23 10:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65153
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P4
Target Milestone|--- |4.9.3
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/65153] [SH][4.9 Regression] "insn does not satisfy its constraints" when compiling libmcrypt
2015-02-21 9:52 [Bug target/65153] New: sh: "insn does not satisfy its constraints" when compiling libmcrypt glaubitz at physik dot fu-berlin.de
` (12 preceding siblings ...)
2015-02-23 10:58 ` rguenth at gcc dot gnu.org
@ 2015-02-25 5:45 ` kkojima at gcc dot gnu.org
2015-02-25 6:30 ` kkojima at gcc dot gnu.org
2015-03-07 19:35 ` olegendo at gcc dot gnu.org
15 siblings, 0 replies; 17+ messages in thread
From: kkojima at gcc dot gnu.org @ 2015-02-25 5:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65153
--- Comment #14 from Kazumoto Kojima <kkojima at gcc dot gnu.org> ---
Author: kkojima
Date: Wed Feb 25 01:00:29 2015
New Revision: 220957
URL: https://gcc.gnu.org/viewcvs?rev=220957&root=gcc&view=rev
Log:
PR target/65153
Backport from mainline: [SH] Fix PR target/65153 with removing movsicc_true+3
peephole2.
Modified:
branches/gcc-4_9-branch/gcc/ChangeLog
branches/gcc-4_9-branch/gcc/config/sh/sh-protos.h
branches/gcc-4_9-branch/gcc/config/sh/sh.c
branches/gcc-4_9-branch/gcc/config/sh/sh.md
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/65153] [SH][4.9 Regression] "insn does not satisfy its constraints" when compiling libmcrypt
2015-02-21 9:52 [Bug target/65153] New: sh: "insn does not satisfy its constraints" when compiling libmcrypt glaubitz at physik dot fu-berlin.de
` (13 preceding siblings ...)
2015-02-25 5:45 ` kkojima at gcc dot gnu.org
@ 2015-02-25 6:30 ` kkojima at gcc dot gnu.org
2015-03-07 19:35 ` olegendo at gcc dot gnu.org
15 siblings, 0 replies; 17+ messages in thread
From: kkojima at gcc dot gnu.org @ 2015-02-25 6:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65153
Kazumoto Kojima <kkojima at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #15 from Kazumoto Kojima <kkojima at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/65153] [SH][4.9 Regression] "insn does not satisfy its constraints" when compiling libmcrypt
2015-02-21 9:52 [Bug target/65153] New: sh: "insn does not satisfy its constraints" when compiling libmcrypt glaubitz at physik dot fu-berlin.de
` (14 preceding siblings ...)
2015-02-25 6:30 ` kkojima at gcc dot gnu.org
@ 2015-03-07 19:35 ` olegendo at gcc dot gnu.org
15 siblings, 0 replies; 17+ messages in thread
From: olegendo at gcc dot gnu.org @ 2015-03-07 19:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65153
--- Comment #16 from Oleg Endo <olegendo at gcc dot gnu.org> ---
Author: olegendo
Date: Sat Mar 7 19:35:22 2015
New Revision: 221257
URL: https://gcc.gnu.org/viewcvs?rev=221257&root=gcc&view=rev
Log:
gcc/testsuite/
PR target/65153
* gcc.c-torture/compile/pr65153.c: New.
Added:
trunk/gcc/testsuite/gcc.c-torture/compile/pr65153.c
Modified:
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 17+ messages in thread