This avoids decomposing hard-register accesses that masquerade as
loads.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

2021-08-11  Richard Biener  <rguent...@suse.de>

        PR target/101877
        * tree-ssa-forwprop.c (pass_forwprop::execute): Do not decompose
        hard-register accesses.
---
 gcc/tree-ssa-forwprop.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index bd64b8e46bc..5b30d4c1a76 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -3190,7 +3190,8 @@ pass_forwprop::execute (function *fun)
                       || (fun->curr_properties & PROP_gimple_lvec))
                   && gimple_assign_load_p (stmt)
                   && !gimple_has_volatile_ops (stmt)
-                  && !stmt_can_throw_internal (cfun, stmt))
+                  && !stmt_can_throw_internal (cfun, stmt)
+                  && (!VAR_P (rhs) || !DECL_HARD_REGISTER (rhs)))
            optimize_vector_load (&gsi);
 
          else if (code == COMPLEX_EXPR)
-- 
2.31.1

Reply via email to