public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITTED] Propagator should call value_of_stmt.
@ 2022-06-16 18:19 Andrew MacLeod
  0 siblings, 0 replies; only message in thread
From: Andrew MacLeod @ 2022-06-16 18:19 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 480 bytes --]

When evaluating the LHS of a stmt, its more efficient/better to call 
value_of_stmt directly rather than value_of_expr.  The value_of_* 
routines are not quite as efficient as the range_of routines, plus 
value_of_expr will check if its a LHS, and invoke value_of_stmt if it is.

This in fact speeds VRP up by about 1.5%... it bypasses some other stuff 
the value_of_expr checks that is not necessary.

Bootstrapped on x86_64-pc-linux-gnu with no regressions.  Pushed.

Andrew


[-- Attachment #2: 0001-Propagator-should-call-value_of_stmt.patch --]
[-- Type: text/x-patch, Size: 1077 bytes --]

From 5b1594dc2d053803ae98ae39f76fbd71f35cb657 Mon Sep 17 00:00:00 2001
From: Andrew MacLeod <amacleod@redhat.com>
Date: Thu, 31 Mar 2022 09:36:59 -0400
Subject: [PATCH 1/2] Propagator should call value_of_stmt.

When evaluating the LHS of a stmt, its more efficent/better to call
value_of_stmt directly rather than value_of_expr.

	* tree-ssa-propagate.cc (before_dom_children): Call value_of_stmt.
---
 gcc/tree-ssa-propagate.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/tree-ssa-propagate.cc b/gcc/tree-ssa-propagate.cc
index c10ffd91766..5983f029364 100644
--- a/gcc/tree-ssa-propagate.cc
+++ b/gcc/tree-ssa-propagate.cc
@@ -813,7 +813,7 @@ substitute_and_fold_dom_walker::before_dom_children (basic_block bb)
       tree lhs = gimple_get_lhs (stmt);
       if (lhs && TREE_CODE (lhs) == SSA_NAME)
 	{
-	  tree sprime = substitute_and_fold_engine->value_of_expr (lhs, stmt);
+	  tree sprime = substitute_and_fold_engine->value_of_stmt (stmt, lhs);
 	  if (sprime
 	      && sprime != lhs
 	      && may_propagate_copy (lhs, sprime)
-- 
2.17.2


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-16 18:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-16 18:19 [COMMITTED] Propagator should call value_of_stmt Andrew MacLeod

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).