Re: [RFC][IPA-VRP] Disable setting param of __builtin_constant_p to null

2016-07-25 Thread Richard Biener
On Mon, Jul 25, 2016 at 8:59 AM, kugan
 wrote:
> Hi,
>
>>> diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
>>> index ecfab1f..23c12b5 100644
>>> --- a/gcc/tree-vrp.c
>>> +++ b/gcc/tree-vrp.c
>>> @@ -3759,8 +3759,10 @@ extract_range_basic (value_range *vr, gimple
>>> *stmt)
>>>   && SSA_NAME_IS_DEFAULT_DEF (arg)
>>>   && TREE_CODE (SSA_NAME_VAR (arg)) == PARM_DECL)
>>> {
>>> +#if 0
>>>   set_value_range_to_null (vr, type);
>>>   return;
>>> +#endif
>>
>>
>> It is not cleanest either, but better to test cfun->after_inlining
>
>
> Thanks. Here is the patch which does this. Bootstrapped and regression
> tested with the rest of the patches in the series. Is this OK for trunk?

Ok.

Richard.

> Thanks,
> Kugan
>
> gcc/ChangeLog:
>
> 2016-07-25  Kugan Vivekanandarajah  
>
> * tree-vrp.c (extract_range_basic): Check cfun->after_inlining
> before
> folding call to __builtin_constant_p with parameters to false.


Re: [RFC][IPA-VRP] Disable setting param of __builtin_constant_p to null

2016-07-25 Thread kugan

Hi,


diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index ecfab1f..23c12b5 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -3759,8 +3759,10 @@ extract_range_basic (value_range *vr, gimple *stmt)
  && SSA_NAME_IS_DEFAULT_DEF (arg)
  && TREE_CODE (SSA_NAME_VAR (arg)) == PARM_DECL)
{
+#if 0
  set_value_range_to_null (vr, type);
  return;
+#endif


It is not cleanest either, but better to test cfun->after_inlining


Thanks. Here is the patch which does this. Bootstrapped and regression 
tested with the rest of the patches in the series. Is this OK for trunk?


Thanks,
Kugan

gcc/ChangeLog:

2016-07-25  Kugan Vivekanandarajah  

* tree-vrp.c (extract_range_basic): Check cfun->after_inlining before
folding call to __builtin_constant_p with parameters to false.
>From 4805ea975de0fd3b183b27324df1caa7ff29f887 Mon Sep 17 00:00:00 2001
From: Kugan Vivekanandarajah 
Date: Sat, 25 Jun 2016 11:52:57 +1000
Subject: [PATCH 2/7] Prevent setting __builtin_constant_p of param to null
 before inlining in Early VRP

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

diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index bdfc1b6..edaacf2 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -3763,7 +3763,8 @@ extract_range_basic (value_range *vr, gimple *stmt)
 	  arg = gimple_call_arg (stmt, 0);
 	  if (TREE_CODE (arg) == SSA_NAME
 	  && SSA_NAME_IS_DEFAULT_DEF (arg)
-	  && TREE_CODE (SSA_NAME_VAR (arg)) == PARM_DECL)
+	  && TREE_CODE (SSA_NAME_VAR (arg)) == PARM_DECL
+	  && cfun->after_inlining)
 	{
 	  set_value_range_to_null (vr, type);
 	  return;
-- 
1.9.1



Re: [RFC][IPA-VRP] Disable setting param of __builtin_constant_p to null

2016-07-15 Thread Jan Hubicka
> Hi,
> 
> 
> 
> VRP assumes that it is run after inlining. Therefore, if there is a
> call to __builtin_constant_p with function parameter, it resolve it
> to false to avoid bogus warnings. Since we use this as an early vrp
> before inling, it leads to  wrong code. As a workaround I have
> disabled it for the time being. That is, this patch is not intended
> for committing but just to get the VRP tested.
> 
> 
> 
> Original patch which introduced this also talks about doing it earlier.
> 
> 
> 
> 
> 
> Thanks,
> 
> Kugan

> >From 99f8e7884d582cfae2d7cb50ad59dab7ac6772fc Mon Sep 17 00:00:00 2001
> From: Kugan Vivekanandarajah 
> Date: Sat, 25 Jun 2016 11:52:57 +1000
> Subject: [PATCH 1/6] Hack-Prevent setting __builtin_constant_p of param to
>  null before inlining in Early VRP
> 
> ---
>  gcc/tree-vrp.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
> index ecfab1f..23c12b5 100644
> --- a/gcc/tree-vrp.c
> +++ b/gcc/tree-vrp.c
> @@ -3759,8 +3759,10 @@ extract_range_basic (value_range *vr, gimple *stmt)
> && SSA_NAME_IS_DEFAULT_DEF (arg)
> && TREE_CODE (SSA_NAME_VAR (arg)) == PARM_DECL)
>   {
> +#if 0
> set_value_range_to_null (vr, type);
> return;
> +#endif

It is not cleanest either, but better to test cfun->after_inlining

Honza


[RFC][IPA-VRP] Disable setting param of __builtin_constant_p to null

2016-07-14 Thread kugan

Hi,



VRP assumes that it is run after inlining. Therefore, if there is a call 
to __builtin_constant_p with function parameter, it resolve it to false 
to avoid bogus warnings. Since we use this as an early vrp before 
inling, it leads to  wrong code. As a workaround I have disabled it for 
the time being. That is, this patch is not intended for committing but 
just to get the VRP tested.




Original patch which introduced this also talks about doing it earlier.





Thanks,

Kugan
>From 99f8e7884d582cfae2d7cb50ad59dab7ac6772fc Mon Sep 17 00:00:00 2001
From: Kugan Vivekanandarajah 
Date: Sat, 25 Jun 2016 11:52:57 +1000
Subject: [PATCH 1/6] Hack-Prevent setting __builtin_constant_p of param to
 null before inlining in Early VRP

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

diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index ecfab1f..23c12b5 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -3759,8 +3759,10 @@ extract_range_basic (value_range *vr, gimple *stmt)
 	  && SSA_NAME_IS_DEFAULT_DEF (arg)
 	  && TREE_CODE (SSA_NAME_VAR (arg)) == PARM_DECL)
 	{
+#if 0
 	  set_value_range_to_null (vr, type);
 	  return;
+#endif
 	}
 	  break;
 	  /* Both __builtin_ffs* and __builtin_popcount return
-- 
1.9.1