diff mbox series

[05/13] ssa-loop-niter: skip caching of null operands

Message ID ork02dfpbv.fsf@lxoliva.fsfla.org
State New
Headers show
Series [01/13] scoped tables: insert before further lookups | expand

Commit Message

Alexandre Oliva Dec. 27, 2022, 4:22 a.m. UTC
When a TREE_OPERAND is NULL, do not cache it.

Regstrapped on x86_64-linux-gnu.  Ok to install?


for  gcc/ChangeLog

	* tree-ssa-loop-niter.cc (expand_simple_operands): Refrain
	from caching NULL TREE_OPERANDs.
---
 gcc/tree-ssa-loop-niter.cc |    2 ++
 1 file changed, 2 insertions(+)

Comments

Jeff Law Dec. 27, 2022, 3:19 p.m. UTC | #1
On 12/26/22 21:22, Alexandre Oliva via Gcc-patches wrote:
> 
> When a TREE_OPERAND is NULL, do not cache it.
> 
> Regstrapped on x86_64-linux-gnu.  Ok to install?
> 
> 
> for  gcc/ChangeLog
> 
> 	* tree-ssa-loop-niter.cc (expand_simple_operands): Refrain
> 	from caching NULL TREE_OPERANDs.
I must admit some curiosity about the NULL operand though.  Do you 
recall what kind of node had a NULL operand and whether or not that was 
a valid state or not?

I just want to make sure this isn't just papering over a deeper issue.

jeff
Alexandre Oliva Dec. 28, 2022, 4:03 a.m. UTC | #2
Hello, Jeff,

On Dec 27, 2022, Jeff Law <jeffreyalaw@gmail.com> wrote:

>> * tree-ssa-loop-niter.cc (expand_simple_operands): Refrain
>> from caching NULL TREE_OPERANDs.

> I must admit some curiosity about the NULL operand though.  Do you
> recall what kind of node had a NULL operand and whether or not that
> was a valid state or not?

I'm pretty sure the case I hit was a CALL_EXPR.


Thanks for the reviews!

Happy GNU Year!
diff mbox series

Patch

diff --git a/gcc/tree-ssa-loop-niter.cc b/gcc/tree-ssa-loop-niter.cc
index fece876099c16..17645648326e8 100644
--- a/gcc/tree-ssa-loop-niter.cc
+++ b/gcc/tree-ssa-loop-niter.cc
@@ -2325,6 +2325,8 @@  expand_simple_operations (tree expr, tree stop, hash_map<tree, tree> &cache)
       for (i = 0; i < n; i++)
 	{
 	  e = TREE_OPERAND (expr, i);
+	  if (!e)
+	    continue;
 	  /* SCEV analysis feeds us with a proper expression
 	     graph matching the SSA graph.  Avoid turning it
 	     into a tree here, thus handle tree sharing