public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITTED] Do not assume LHS of call is an ssa-name.
@ 2024-06-14 19:20 Andrew MacLeod
  2024-06-17  6:23 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew MacLeod @ 2024-06-14 19:20 UTC (permalink / raw)
  To: gcc-patches; +Cc: hernandez, aldy

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

gimple_range_fold makes an assumption that if there is a LHS on a call 
that it is an ssa_name.  Especially later in compilation that may not be 
true.

This patch merely avoids calling routines that assume an ssa-name is 
being passed in.

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

Andrew


[-- Attachment #2: 0001-Do-not-assume-LHS-of-call-is-an-ssa-name.patch --]
[-- Type: text/x-patch, Size: 1019 bytes --]

From cef90b0558032b64b021054370ad5b96f8a5c5d8 Mon Sep 17 00:00:00 2001
From: Andrew MacLeod <amacleod@redhat.com>
Date: Wed, 12 Jun 2024 09:20:20 -0400
Subject: [PATCH 1/7] Do not assume LHS of call is an ssa-name.

gimple_range_fold makes an assumption that the LHS of a call is an
ssa_name, which later in compilation may not be true.

	* gimple-range-fold.cc (fold_using_range::range_of_call): Ensure
	LHS is an SSA_NAME before invoking gimple_range_global.
---
 gcc/gimple-range-fold.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/gimple-range-fold.cc b/gcc/gimple-range-fold.cc
index 6037c29ce11..52fc3f2cb04 100644
--- a/gcc/gimple-range-fold.cc
+++ b/gcc/gimple-range-fold.cc
@@ -1105,7 +1105,7 @@ fold_using_range::range_of_call (vrange &r, gcall *call, fur_source &)
     }
 
   // If there is an LHS, intersect that with what is known.
-  if (lhs)
+  if (gimple_range_ssa_p (lhs))
     {
       Value_Range def (TREE_TYPE (lhs));
       gimple_range_global (def, lhs);
-- 
2.45.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [COMMITTED] Do not assume LHS of call is an ssa-name.
  2024-06-14 19:20 [COMMITTED] Do not assume LHS of call is an ssa-name Andrew MacLeod
@ 2024-06-17  6:23 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2024-06-17  6:23 UTC (permalink / raw)
  To: Andrew MacLeod; +Cc: gcc-patches, hernandez, aldy

On Fri, Jun 14, 2024 at 9:20 PM Andrew MacLeod <amacleod@redhat.com> wrote:
>
> gimple_range_fold makes an assumption that if there is a LHS on a call
> that it is an ssa_name.  Especially later in compilation that may not be
> true.

It's always true if the LHS is of register type (is_gimple_reg_type) and
never true when the LHS is of aggregate type.  So either range_of_call
should have not been invoked here or it should indeed be defensive
as in your patch.

> This patch merely avoids calling routines that assume an ssa-name is
> being passed in.
>
> Bootstraps on  x86_64-pc-linux-gnu with no regressions.   Pushed.
>
> Andrew
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-06-17  6:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-14 19:20 [COMMITTED] Do not assume LHS of call is an ssa-name Andrew MacLeod
2024-06-17  6:23 ` Richard Biener

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