[1/2] target/113255 - avoid REG_POINTER on a pointer difference

Message ID 20240201141910.271D738582BB@sourceware.org
State Committed
Commit 5b281946c4b51132caf5e5b64c730fef92dd6123
Headers
Series [1/2] target/113255 - avoid REG_POINTER on a pointer difference |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gcc_check--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 success Testing passed

Commit Message

Richard Biener Feb. 1, 2024, 2:18 p.m. UTC
  The following avoids re-using a register holding a pointer (and
thus might be REG_POINTER) for the result of a pointer difference
computation.  That might confuse heuristics in (broken) RTL alias
analysis which relies on REG_POINTER indicating that we're
dealing with one.

This alone doesn't fix anything.

Bootstrapped and tested on x86_64-unknown-linux-gnu, OK for trunk
and branches (as necessary)?

Thanks,
Richard.

	PR target/113255
	* config/i386/i386-expand.cc
	(expand_set_or_cpymem_prologue_epilogue_by_misaligned_moves):
	Use a new pseudo for the skipped number of bytes.
---
 gcc/config/i386/i386-expand.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
index 0d817fc3f3b..26c48e8b0c8 100644
--- a/gcc/config/i386/i386-expand.cc
+++ b/gcc/config/i386/i386-expand.cc
@@ -8090,7 +8090,7 @@  expand_set_or_cpymem_prologue_epilogue_by_misaligned_moves (rtx destmem, rtx src
       /* See how many bytes we skipped.  */
       saveddest = expand_simple_binop (GET_MODE (*destptr), MINUS, saveddest,
 				       *destptr,
-				       saveddest, 1, OPTAB_DIRECT);
+				       NULL_RTX, 1, OPTAB_DIRECT);
       /* Adjust srcptr and count.  */
       if (!issetmem)
 	*srcptr = expand_simple_binop (GET_MODE (*srcptr), MINUS, *srcptr,