diff mbox

[RFC,IPA-VRP] Check for POINTER_TYPE_P before accessing SSA_NAME_PTR_INFO in tree-inline

Message ID 578869F9.5040606@linaro.org
State New
Headers show

Commit Message

Kugan Vivekanandarajah July 15, 2016, 4:43 a.m. UTC
Hi,



This patch adds check for POINTER_TYPE_P before accessing 
SSA_NAME_PTR_INFO in remap_ssa_name in gcc/tree-inline.c. This is not 
related to IPA_VRP but was exposed by that.



Thanks,

Kugan





gcc/ChangeLog:



2016-07-14  Kugan Vivekanandarajah  <kuganv@linaro.org>



         * tree-inline.c (remap_ssa_name): Check for POINTER_TYPE_P before

         accessing SSA_NAME_PTR_INFO.

Comments

Kugan Vivekanandarajah July 15, 2016, 7:02 a.m. UTC | #1
Hi Andrew,

>> This patch adds check for POINTER_TYPE_P before accessing SSA_NAME_PTR_INFO

>> in remap_ssa_name in gcc/tree-inline.c. This is not related to IPA_VRP but

>> was exposed by that.

>

> SSA_NAME_PTR_INFO should be NULL for non POINTER_TYPE ssa names?  Why

> is it not null in your case?

> In both cases there is a check for SSA_NAME_PTR_INFO being NULL before using it.


As per tree.h:

#define SSA_NAME_PTR_INFO(N) \
    SSA_NAME_CHECK (N)->ssa_name.info.ptr_info

#define SSA_NAME_RANGE_INFO(N) \
     SSA_NAME_CHECK (N)->ssa_name.info.range_info

ptr_info and range_info are unions (see below). Unless I am missing 
something, now that we set range_info, we should check it is 
POINTER_TYPE_P before accessing.

   /* Value range information.  */
   union ssa_name_info_type {
     /* Pointer attributes used for alias analysis.  */
     struct GTY ((tag ("0"))) ptr_info_def *ptr_info;
     /* Value range attributes used for zero/sign extension elimination.  */
     struct GTY ((tag ("1"))) range_info_def *range_info;
   } GTY ((desc ("%1.typed.type ?" \
		"!POINTER_TYPE_P (TREE_TYPE ((tree)&%1)) : 2"))) info;


Thanks,
Kugan
diff mbox

Patch

From 7c1e5f3058a55d635e57bb4e9f2fd4ff14cd2b94 Mon Sep 17 00:00:00 2001
From: Kugan Vivekanandarajah <kugan.vivekanandarajah@linaro.org>
Date: Tue, 5 Jul 2016 17:14:52 +1000
Subject: [PATCH 2/6] Inliner Check for POINTER_TYPE

---
 gcc/tree-inline.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 07f6a83..f926304 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -244,6 +244,7 @@  remap_ssa_name (tree name, copy_body_data *id)
       /* At least IPA points-to info can be directly transferred.  */
       if (id->src_cfun->gimple_df
 	  && id->src_cfun->gimple_df->ipa_pta
+	  && POINTER_TYPE_P (TREE_TYPE (name))
 	  && (pi = SSA_NAME_PTR_INFO (name))
 	  && !pi->pt.anything)
 	{
@@ -276,6 +277,7 @@  remap_ssa_name (tree name, copy_body_data *id)
       /* At least IPA points-to info can be directly transferred.  */
       if (id->src_cfun->gimple_df
 	  && id->src_cfun->gimple_df->ipa_pta
+	  && POINTER_TYPE_P (TREE_TYPE (name))
 	  && (pi = SSA_NAME_PTR_INFO (name))
 	  && !pi->pt.anything)
 	{
-- 
1.9.1