diff mbox

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

Message ID 57886993.3010901@linaro.org
State New
Headers show

Commit Message

Kugan Vivekanandarajah July 15, 2016, 4:41 a.m. UTC
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

Comments

Jan Hubicka July 15, 2016, 8:42 a.m. UTC | #1
> 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 <kugan.vivekanandarajah@linaro.org>
> 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
diff mbox

Patch

From 99f8e7884d582cfae2d7cb50ad59dab7ac6772fc Mon Sep 17 00:00:00 2001
From: Kugan Vivekanandarajah <kugan.vivekanandarajah@linaro.org>
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