public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/101426] New: Wrong code redirecting IPA thunk parms to tail-call
@ 2021-07-12 7:54 krebbel at gcc dot gnu.org
2021-07-12 8:02 ` [Bug rtl-optimization/101426] " krebbel at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: krebbel at gcc dot gnu.org @ 2021-07-12 7:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101426
Bug ID: 101426
Summary: Wrong code redirecting IPA thunk parms to tail-call
Product: gcc
Version: 10.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: krebbel at gcc dot gnu.org
Target Milestone: ---
Created attachment 51135
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51135&action=edit
Testcase
Building the attached testcase with:
cc1plus -fpreprocessed t.cc -quiet -m64 -mzarch -O2
Produces wrong code with GCC commits up to g:9725df0233b
A specialized clone of AShrOp::build without the first parameter is created.
The calls in the foo* functions to the clone have to shift the function
parameters one hard reg down to fit the signature of the clone:
void r::NSPACE::foo1 (struct OpBuilder & D.2900, struct OperationState & state,
struct ValueRange operands, struct ArrayRef attributes)
{
<bb 2> [local count: 1073741824]:
r::NSPACE::AShrOp::build.constprop (state_3(D), operands, attributes); [tail
call]
return;
}
The generated code overwrites the 2. and the 3. parameter with the 4. of the
caller:
lgr %r2,%r3
lgr %r4,%r5
lgr %r3,%r5
jg
_ZN1r6NSPACE6AShrOp5buildERNS_9OpBuilderERNS_14OperationStateENS_10ValueRangeEN6nspace8ArrayRefISt4pairINS_10IdentifierENS_9AttributeEEEE.constprop.0
The problem does not occur on head and 10.3 after this commit g:defafb78cbc
With this the parameters are always copied.
The fix was done for PR90448 to fix an ICE triggered when building and address
operand based on the DECL_RTL of the parameter which wasn't addressable at that
point. I think the situation is a bit different here. The code wires up the
incoming hardregs with the callee parms without considering that the resulting
moves might affect each other.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug rtl-optimization/101426] Wrong code redirecting IPA thunk parms to tail-call
2021-07-12 7:54 [Bug rtl-optimization/101426] New: Wrong code redirecting IPA thunk parms to tail-call krebbel at gcc dot gnu.org
@ 2021-07-12 8:02 ` krebbel at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: krebbel at gcc dot gnu.org @ 2021-07-12 8:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101426
--- Comment #1 from Andreas Krebbel <krebbel at gcc dot gnu.org> ---
Created attachment 51136
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51136&action=edit
Experimental Fix
With this patch the address is copied to a pseudo first. That way the register
allocator will sort out the dependencies resulting in the following code being
generated:
lgr %r2,%r3
lgr %r3,%r4
lgr %r4,%r5
jg
_ZN1r6NSPACE6AShrOp5buildERNS_9OpBuilderERNS_14OperationStateENS_10ValueRangeEN6nspace8ArrayRefISt4pairINS_10IdentifierENS_9AttributeEEEE.constprop.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-07-12 8:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-12 7:54 [Bug rtl-optimization/101426] New: Wrong code redirecting IPA thunk parms to tail-call krebbel at gcc dot gnu.org
2021-07-12 8:02 ` [Bug rtl-optimization/101426] " krebbel at gcc dot gnu.org
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).