This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Speed-up use-after-scope (re-writing to SSA) (version 2)
- From: Martin Liška <mliska at suse dot cz>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 18 Jan 2017 16:34:48 +0100
- Subject: Re: [PATCH] Speed-up use-after-scope (re-writing to SSA) (version 2)
- Authentication-results: sourceware.org; auth=none
- References: <20161116130733.GT3541@tucnak.redhat.com> <469bf86a-e43c-c571-66e4-87db78b6fb11@suse.cz> <20161116162841.GX3541@tucnak.redhat.com> <c02f7364-44ed-406f-cee4-7b1fc8899f75@suse.cz> <20161221085200.GS21933@tucnak> <4ec48432-9df6-154a-1b13-065b9772cbbf@suse.cz> <20161222172140.GF21933@tucnak> <29d32a7c-a95d-ddb1-d64e-ae8f659d3a4b@suse.cz> <20170116142025.GO1867@tucnak> <7e7f795d-a7a7-584e-8c77-61ea01207c40@suse.cz> <20170117164721.GE1867@tucnak>
Hello.
During bootstrap, I came to following test-case:
struct A
{
int regno;
};
struct
{
A base;
} typedef *df_ref;
int *a;
void
fn1 (int N)
{
for (int i = 0; i < N; i++)
{
df_ref b;
a[(b)->base.regno]++;
}
}
As we expand all usages of an LHS of a ASAN_POISON to all uses, we propagate that to
a PHI node that originally contained ASAN_MARK (UNPOISON):
<bb 4> [0.00%]:
ASAN_MARK (UNPOISON, &b, 8);
a.0_1 = a;
b.1_2 = b;
_3 = b.1_2->base.regno;
_4 = (long unsigned int) _3;
_5 = _4 * 4;
_6 = a.0_1 + _5;
_7 = *_6;
_8 = _7 + 1;
*_6 = _8;
ASAN_MARK (POISON, &b, 8);
i_17 = i_9 + 1;
goto <bb 3>; [0.00%]
Is transformed to:
<bb 3> [0.00%]:
# i_9 = PHI <0(2), i_17(4)>
# b_18 = PHI <b_19(D)(2), b_20(4)>
if (i_9 >= N_13(D))
goto <bb 5>; [0.00%]
else
goto <bb 4>; [0.00%]
<bb 4> [0.00%]:
a.0_1 = a;
b.1_2 = b_18;
_3 = b.1_2->base.regno;
_4 = (long unsigned int) _3;
_5 = _4 * 4;
_6 = a.0_1 + _5;
_7 = *_6;
_8 = _7 + 1;
*_6 = _8;
b_20 = ASAN_POISON ();
i_17 = i_9 + 1;
goto <bb 3>; [0.00%]
Motivation for propagation over PHI nodes was:
cat use.c
int
main (int argc, char **argv)
{
int *ptr = 0;
if (argc == 1)
{
int my_char;
ptr = &my_char;
}
if (ptr)
return *ptr;
return 0;
}
I'm thinking whether the selected approach is fundamentally wrong, our we'll have to stop the PHI propagation
and we still be able to catch some cases with -O2?
Thanks,
Martin