diff options
author | Martin Jambor <mjambor@suse.cz> | 2014-09-03 16:26:38 +0200 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2014-09-03 16:26:38 +0200 |
commit | c8f403525ae53bc8cdba13ea5f8d8f9a95ed08d6 (patch) | |
tree | 0474a224e6767ff5d3e683ccecb93ecc6f3c7fcd /gcc | |
parent | 6f9549ee682082ec99fac4d73626fc8fc6f5f73b (diff) | |
download | gcc-c8f403525ae53bc8cdba13ea5f8d8f9a95ed08d6.zip gcc-c8f403525ae53bc8cdba13ea5f8d8f9a95ed08d6.tar.gz gcc-c8f403525ae53bc8cdba13ea5f8d8f9a95ed08d6.tar.bz2 |
re PR ipa/62015 (ipa-cp-clone uses a clone that is too specialized for the call context)
2014-09-03 Martin Jambor <mjambor@suse.cz>
PR ipa/62015
* ipa-cp.c (intersect_aggregates_with_edge): Handle impermissible
pass-trough jump functions correctly.
testsuite/
* g++.dg/ipa/pr62015.C: New test.
From-SVN: r214878
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ipa-cp.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ipa/pr62015.C | 55 |
4 files changed, 76 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fdafce8..de64816 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2014-09-03 Martin Jambor <mjambor@suse.cz> + PR ipa/62015 + * ipa-cp.c (intersect_aggregates_with_edge): Handle impermissible + pass-trough jump functions correctly. + +2014-09-03 Martin Jambor <mjambor@suse.cz> + PR ipa/61986 * ipa-cp.c (find_aggregate_values_for_callers_subset): Chain created replacements in ascending order of offsets. diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 58121d4..d365634 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -3048,6 +3048,11 @@ intersect_aggregates_with_edge (struct cgraph_edge *cs, int index, intersect_with_agg_replacements (cs->caller, src_idx, &inter, 0); } + else + { + inter.release (); + return vNULL; + } } else { @@ -3063,6 +3068,11 @@ intersect_aggregates_with_edge (struct cgraph_edge *cs, int index, else intersect_with_plats (src_plats, &inter, 0); } + else + { + inter.release (); + return vNULL; + } } } else if (jfunc->type == IPA_JF_ANCESTOR diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7d3c32b..f0bca8f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2014-09-03 Martin Jambor <mjambor@suse.cz> + PR ipa/62015 + * g++.dg/ipa/pr62015.C: New test. + +2014-09-03 Martin Jambor <mjambor@suse.cz> + PR ipa/61986 * gcc.dg/ipa/pr61986.c: New test. diff --git a/gcc/testsuite/g++.dg/ipa/pr62015.C b/gcc/testsuite/g++.dg/ipa/pr62015.C new file mode 100644 index 0000000..950b46e --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr62015.C @@ -0,0 +1,55 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -std=c++11" } */ + + +extern "C" int printf(const char *fmt, ...); +extern "C" void abort(void); + +struct Side { + enum _Value { Left, Right, Invalid }; + + constexpr Side() : _value(Invalid) {} + constexpr Side(_Value value) : _value(value) {} + operator _Value() const { return (_Value)_value; } + + private: + char _value; +}; + +struct A { + void init(); + void adjust(Side side, bool final); + void move(Side side); +}; + +void A::init() +{ + adjust(Side::Invalid, false); +} + +static void __attribute__((noinline)) +check (int v, int final) +{ + if (v != 0) + abort(); +} + + +__attribute__((noinline)) +void A::adjust(Side side, bool final) +{ + check ((int)side, final); +} + +void A::move(Side side) +{ + adjust(side, false); + adjust(side, true); +} + +int main() +{ + A t; + t.move(Side::Left); + return 0; +} |