aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2022-03-09 15:17:27 +0100
committerRichard Biener <rguenther@suse.de>2022-03-09 15:56:23 +0100
commitbded0d549fdfdc1328b2c0189dc5f8593b4cbe42 (patch)
tree124faa91b541e6ea8795667831566934c93d31b6 /gcc
parentcaa6c33c5d5223c50657b08e73177e8d54ceee51 (diff)
downloadgcc-bded0d549fdfdc1328b2c0189dc5f8593b4cbe42.zip
gcc-bded0d549fdfdc1328b2c0189dc5f8593b4cbe42.tar.gz
gcc-bded0d549fdfdc1328b2c0189dc5f8593b4cbe42.tar.bz2
Restore INDIRECT_REF asm operand heuristic with MEM_REF
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. 2022-03-09 Richard Biener <rguenther@suse.de> * cfgexpand.cc (expand_gimple_asm): Special-case MEM_REF with non-decl operand, avoiding a copy.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cfgexpand.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc
index 4f99f04..d3cc77d 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))