This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[RFC][IPA-VRP] IPA VRP Implementation
- From: kugan <kugan dot vivekanandarajah at linaro dot org>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, Jan Hubicka <hubicka at ucw dot cz>, Martin Jambor <mjambor at suse dot cz>
- Date: Fri, 15 Jul 2016 14:40:41 +1000
- Subject: [RFC][IPA-VRP] IPA VRP Implementation
- Authentication-results: sourceware.org; auth=none
Hi,
This patch series implements IPA-VRP based on the previous discussions
in https://gcc.gnu.org/ml/gcc/2016-01/msg00063.html.
0001-Hack-Prevent-setting-__builtin_constant_p-of-param-t.patch -This is
to prevent EVRP setting result of __builtin_constant_p to null that will
inlined later.
0002-Inliner-Check-for-POINTER_TYPE.patch - This is to make sure that we
call SSA_NAME_PTR_INFO only for POINTER_TYPE_P. This is exposed with
IPA-VRP but not related to rest of the patch.
0003-Refactor-vrp.patch - Re-factors tree-vrp to expose some of the
common functionalities.
0004-Add-early-vrp.patch - Adds a simple Early VRP pass.
0005-Add-ipa-vrp.patch - Implements IPA VRP
0006-Teach-tree-vrp-to-use-ipa-vrp-results.patch - Teaches tree-vrp to
use the value ranges set for the PARMs.
More details about the patches are later with each patch.
Before I go into the details, here is a simple example and the relevant
dumps as of now:
static __attribute__((noinline, noclone))
int foo (int i)
{
if (i > 5)
printf ("OK\n");
else
printf ("NOK\n");
}
int bar (int j)
{
if (j > 8)
return foo (j + 2);
else if (j > 2)
return foo (j + 3);
return 0;
}
The Early VRP dump shows:
_1: [11, +INF(OVF)]
_2: [6, 11]
....
bar (int j)
{
....
_8 = foo (_1);
goto <bb 6>;
<bb 4>:
if (j_5(D) > 2)
goto <bb 5>;
else
goto <bb 6>;
<bb 5>:
_2 = j_5(D) + 3;
_10 = foo (_2);
....
The IPA-CP dump shows:
....
Modification phase of node foo/0
Setting value range of param 0 [6, 2147483647]
__attribute__((noclone, noinline))
foo (int i)
....
The VRP1 dump shows:
Value ranges after VRP:
.MEM_1: VARYING
i_2(D): [6, +INF]
Folding predicate i_2(D) > 5 to 1
Removing basic block 4
Merging blocks 2 and 3
Merging blocks 2 and 5
__attribute__((noclone, noinline))
foo (int i)
{
<bb 2>:
__builtin_puts (&"OK"[0]);
return;
}
I have bootstrapped and regression tested the patches in this series on
x86-64 and aarch64 (both normal bootstrap and LTO bootstrap).
There are couple of testcase failures which I am looking into.
Any thoughts?
Thanks,
Kugan