public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rdsandiford at googlemail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/43804] [4.5/4.6 regression] ICE in reload_cse_simplify_operands
Date: Mon, 03 May 2010 09:53:00 -0000 [thread overview]
Message-ID: <20100503095309.8969.qmail@sourceware.org> (raw)
In-Reply-To: <bug-43804-50@http.gcc.gnu.org/bugzilla/>
------- Comment #13 from rdsandiford at googlemail dot com 2010-05-03 09:53 -------
Subject: Re: [4.5/4.6 regression] ICE in reload_cse_simplify_operands
"mkuvyrkov at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:
> ------- Comment #10 from mkuvyrkov at gcc dot gnu dot org 2010-04-23 10:20 -------
> The problem seems to be in Richard's patch
> (http://article.gmane.org/gmane.comp.gcc.patches/130602) checked in r120961.
>
> All and all, it seems that revision 120961 should be reverted to enable 'T'
> constraint for (flag_pic && !TARGET_PCREL).
>
> The 's' constraint is defined as
> ==
> case 's':
> if (CONST_INT_P (op)
> || (GET_CODE (op) == CONST_DOUBLE
> && GET_MODE (op) == VOIDmode))
> break;
> case 'i':
> if (CONSTANT_P (op))
> win = 1;
> break;
> ==
>
> So, unless I'm missing something, the statement
> "... 's' doesn't accept anything if flag_pic"
> is just wrong.
I meant "flag_pic && !TARGET_PCREL", since only the !TARGET_PCREL case
matters for 'T'. And that was right at the time that I wrote it.
The interesting definition of 's' isn't the one you quote, but the one
in reload:
case 's':
if (CONST_INT_P (operand)
|| (GET_CODE (operand) == CONST_DOUBLE
&& GET_MODE (operand) == VOIDmode))
break;
case 'i':
if (CONSTANT_P (operand)
&& (! flag_pic || LEGITIMATE_PIC_OPERAND_P (operand)))
win = 1;
break;
That is, 's' operands have to satisfy LEGITIMATE_PIC_OPERAND_P when
generating PIC. I'm not sure which version you were quoting, but if it
was constrain_operands, that's a special case. constrain_operands can
rely on the predicates to check for legitimate PIC operands, so there's
no need to repeat the check there.
At the time I committed the patch, LEGITIMATE_PIC_OPERAND_P was
defined as follows:
#define LEGITIMATE_PIC_OPERAND_P(X) \
(!symbolic_operand (X, VOIDmode) \
|| (TARGET_PCREL && REG_STRICT_P))
Thus no symbolic constant was a legitimate PIC operand for
flag_pic && !TARGET_PCREL. Thus nothing satisfied 's' when
flag_pic && !TARGET_PCREL.
The 'T' constraint is defined as follows:
satisifies(T) == satisifies(s) && !TARGET_PCREL
so it followed that nothing should match 'T' when flag_pic.
So the patch was correct at the time it was committed. Please
understand that reverting it is the wrong thing to do. It would
reintroduce the original bug: that constraints _must not_ match
something that the associated predicates do not. Only the other
way is allowed: predicates can allow things that the constraints
don't, within certain limits.
For example, let's say you have an insn that matches:
(define_insn "subsi3"
[(set (match_operand:SI 0 "nonimmediate_operand" "=mda,m,d,a")
(minus:SI (match_operand:SI 1 "general_operand" "0,0,0,0")
(match_operand:SI 2 "general_src_operand"
"I,dT,mSrT,mSrs")))]
""
"@
subq%.l %2, %0
sub%.l %2,%0
sub%.l %2,%0
sub%.l %2,%0"
[(set_attr "type" "aluq_l,alu_l,alu_l,alu_l")
(set_attr "opy" "2")])
And let's suppose that operand 2 is a register that is equal to:
(symbol_ref "x")
If 'T' allows any CONST, SYMBOL_REF or LABEL_REF when flag_pic &&
!TARGET_PCREL (as in your suggested patch), reload could quite happily
establish that operand 2 is (symbol_ref "x"), see that it matches 'T',
and use it. This will then lead to an unrecognisable insn, because
although the constant matches the 'T' constraint, it doesn't match
general_src_operand.
Instead, the bug is that the 'T' constraint wasn't updated by the TLS
support at the same time as LEGITIMATE_PIC_OPERAND_P was. An easy thing
to miss, of course. I think the correct patch is the one I'm about
to attach.
Richard
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43804
next prev parent reply other threads:[~2010-05-03 9:53 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-19 20:11 [Bug rtl-optimization/43804] New: " schwab at linux-m68k dot org
2010-04-19 20:13 ` [Bug rtl-optimization/43804] " schwab at linux-m68k dot org
2010-04-19 20:14 ` schwab at linux-m68k dot org
2010-04-20 8:56 ` rguenth at gcc dot gnu dot org
2010-04-21 10:47 ` mkuvyrkov at gcc dot gnu dot org
2010-04-21 13:23 ` schwab at linux-m68k dot org
2010-04-21 19:43 ` maxim at codesourcery dot com
2010-04-21 22:52 ` schwab at linux-m68k dot org
2010-04-21 23:40 ` schwab at linux-m68k dot org
2010-04-22 7:10 ` maxim at codesourcery dot com
2010-04-22 9:20 ` schwab at linux-m68k dot org
2010-04-23 10:21 ` mkuvyrkov at gcc dot gnu dot org
2010-05-02 18:02 ` [Bug target/43804] " mkuvyrkov at gcc dot gnu dot org
2010-05-02 18:04 ` mkuvyrkov at gcc dot gnu dot org
2010-05-03 9:53 ` rdsandiford at googlemail dot com [this message]
2010-05-03 9:55 ` rsandifo at gcc dot gnu dot org
2010-05-03 20:17 ` schwab at linux-m68k dot org
2010-05-10 19:49 ` rsandifo at gcc dot gnu dot org
2010-05-19 12:33 ` rguenth at gcc dot gnu dot org
2010-07-31 9:34 ` rguenth at gcc dot gnu dot org
[not found] <bug-43804-4@http.gcc.gnu.org/bugzilla/>
2010-10-18 16:14 ` tg at mirbsd dot org
2010-10-23 17:44 ` tg at mirbsd dot org
2010-12-16 13:28 ` rguenth at gcc dot gnu.org
2011-02-27 11:49 ` mikpe at it dot uu.se
2011-04-28 15:53 ` rguenth at gcc dot gnu.org
2011-07-01 19:36 ` tg at mirbsd dot org
2011-07-26 20:17 ` tg at mirbsd dot org
2011-09-04 18:03 ` leopardboy2 at yahoo dot com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100503095309.8969.qmail@sourceware.org \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).