[PATCH, 4.8, PR57358] Check if optimizing in parm_ref_data_preserved_p
Martin Jambor
mjambor@suse.cz
Wed Jun 12 12:23:00 GMT 2013
Hi,
this is the simplest fix for the PR which happens because there is no
VDEF on a stmt if a particular function is not optimized. I'd like to
fix the bug with it on the branch. Bootstrapped and tested on
x86_64-linux. OK?
Thanks,
Martin
2013-06-11 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/57358
* ipa-prop.c (parm_ref_data_preserved_p): Always return true when
not optimizing.
testsuite/
* gcc.dg/ipa/pr57358.c: New test.
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 53cd5ed..c62dc68 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -678,13 +678,19 @@ parm_ref_data_preserved_p (struct param_analysis_info *parm_ainfo,
bool modified = false;
ao_ref refd;
- gcc_checking_assert (gimple_vuse (stmt));
if (parm_ainfo && parm_ainfo->ref_modified)
return false;
- ao_ref_init (&refd, ref);
- walk_aliased_vdefs (&refd, gimple_vuse (stmt), mark_modified, &modified,
- NULL);
+ if (optimize)
+ {
+ gcc_checking_assert (gimple_vuse (stmt));
+ ao_ref_init (&refd, ref);
+ walk_aliased_vdefs (&refd, gimple_vuse (stmt), mark_modified, &modified,
+ NULL);
+ }
+ else
+ modified = true;
+
if (parm_ainfo && modified)
parm_ainfo->ref_modified = true;
return !modified;
diff --git a/gcc/testsuite/gcc.dg/ipa/pr57358.c b/gcc/testsuite/gcc.dg/ipa/pr57358.c
new file mode 100644
index 0000000..c83396f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr57358.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+struct t { void (*func)(void*); };
+void test_func(struct t* a) __attribute__((optimize("O0")));
+void test_func(struct t* a)
+{
+ a->func(0);
+}
More information about the Gcc-patches
mailing list