* [PATCH] Restore INDIRECT_REF asm operand heuristic with MEM_REF
@ 2022-03-09 14:21 Richard Biener
2022-03-09 14:24 ` Jakub Jelinek
0 siblings, 1 reply; 2+ messages in thread
From: Richard Biener @ 2022-03-09 14:21 UTC (permalink / raw)
To: gcc-patches; +Cc: Jakub Jelinek
As noticed we are looking for INDIRECT_REF with allows_mem to avoid
a copy since then we're sure the operand is in memory (assuming
*& is folded). But INDIRECT_REFs are no longer a thing, the following
replaces the check with a check for a MEM_REF with a non-ADDR_EXPR
operand. This should fix the regression part without fully
exploring all possibilities around tcc_reference operands.
I've placed an assert that we do not see an INDIRECT_REF here.
While we gimplify asm operands we never do any checking on its
IL afterwards.
Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
OK if that succeeds?
Thanks,
Richard.
2022-03-09 Richard Biener <rguenther@suse.de>
* cfgexpand.c (expand_gimple_asm): Special-case MEM_REF
with non-decl operand, avoiding a copy.
---
gcc/cfgexpand.cc | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc
index 4f99f040450..d3cc77d2ca9 100644
--- a/gcc/cfgexpand.cc
+++ b/gcc/cfgexpand.cc
@@ -3290,7 +3290,10 @@ expand_asm_stmt (gasm *stmt)
generating_concat_p = 0;
- if ((TREE_CODE (val) == INDIRECT_REF && allows_mem)
+ gcc_assert (TREE_CODE (val) != INDIRECT_REF);
+ if (((TREE_CODE (val) == MEM_REF
+ && TREE_CODE (TREE_OPERAND (val, 0)) != ADDR_EXPR)
+ && allows_mem)
|| (DECL_P (val)
&& (allows_mem || REG_P (DECL_RTL (val)))
&& ! (REG_P (DECL_RTL (val))
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Restore INDIRECT_REF asm operand heuristic with MEM_REF
2022-03-09 14:21 [PATCH] Restore INDIRECT_REF asm operand heuristic with MEM_REF Richard Biener
@ 2022-03-09 14:24 ` Jakub Jelinek
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2022-03-09 14:24 UTC (permalink / raw)
To: Richard Biener; +Cc: gcc-patches
On Wed, Mar 09, 2022 at 03:21:53PM +0100, Richard Biener wrote:
> As noticed we are looking for INDIRECT_REF with allows_mem to avoid
> a copy since then we're sure the operand is in memory (assuming
> *& is folded). But INDIRECT_REFs are no longer a thing, the following
> replaces the check with a check for a MEM_REF with a non-ADDR_EXPR
> operand. This should fix the regression part without fully
> exploring all possibilities around tcc_reference operands.
>
> I've placed an assert that we do not see an INDIRECT_REF here.
> While we gimplify asm operands we never do any checking on its
> IL afterwards.
>
> Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
>
> OK if that succeeds?
>
> Thanks,
> Richard.
>
> 2022-03-09 Richard Biener <rguenther@suse.de>
>
> * cfgexpand.c (expand_gimple_asm): Special-case MEM_REF
> with non-decl operand, avoiding a copy.
LGTM.
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-09 14:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-09 14:21 [PATCH] Restore INDIRECT_REF asm operand heuristic with MEM_REF Richard Biener
2022-03-09 14:24 ` Jakub Jelinek
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).