diff options
author | Erick Ochoa <erick.ochoa@theobroma-systems.com> | 2020-12-09 09:44:28 +0100 |
---|---|---|
committer | Erick Ochoa <erick.ochoa@theobroma-systems.com> | 2020-12-10 09:45:44 +0100 |
commit | 60bae7965a6353736767fe6073e910a7082b91bd (patch) | |
tree | 3280fc86869f88ca01c7a23fc647ddc06a78b856 | |
parent | 33a10246020b9804270e88919d5bb4abc4747067 (diff) |
fix
-rw-r--r-- | gcc/ipa-type-escape-analysis.c | 30 | ||||
-rw-r--r-- | gcc/ipa-type-escape-analysis.h | 22 |
2 files changed, 36 insertions, 16 deletions
diff --git a/gcc/ipa-type-escape-analysis.c b/gcc/ipa-type-escape-analysis.c index f4917a96b54..181e5f08adb 100644 --- a/gcc/ipa-type-escape-analysis.c +++ b/gcc/ipa-type-escape-analysis.c @@ -175,6 +175,7 @@ along with GCC; see the file COPYING3. If not see #define ABORT_IF_NOT_C true bool detected_incompatible_syntax = false; +bool still_whitelisting = true; // Main function that drives dfe. static unsigned int @@ -335,6 +336,7 @@ get_whitelisted_nodes2 () } } + still_whitelisting = false; return map; } @@ -1888,22 +1890,32 @@ expr_collector::_walk_pre (tree e) if (RECORD_TYPE != TREE_CODE (t)) return; - if (_type_collector.ptrset2.records.is_empty ()) { - _type_collector.ptrset2.records.add (TYPE_MAIN_VARIANT (t)); + if (!still_whitelisting) return; + + if (ptrset3->is_empty ()) { + gcc_assert (TYPE_P (t)); + gcc_assert (TYPE_P (TYPE_MAIN_VARIANT (t))); + ptrset3->add (TYPE_MAIN_VARIANT (t)); + log ("we are adding something to whitelisting for the very first time!\n"); return; } - for (auto - i = _type_collector.ptrset2.records.begin (), - e = _type_collector.ptrset2.records.end (); i != e; ++i) + bool same = true; + for (hash_set<tree>::iterator + i = ptrset3->begin (), + e = ptrset3->end (); i != e; ++i) { tree r = *i; type_incomplete_equality structuralEquality; - bool is_same = structuralEquality.equal (TYPE_MAIN_VARIANT (r), TYPE_MAIN_VARIANT (t)); - if (is_same) continue; + // WHY!?!?!?! + gcc_assert (TYPE_P (r)); + gcc_assert (TYPE_MAIN_VARIANT (r)); + same &= structuralEquality.equal (TYPE_MAIN_VARIANT (r), TYPE_MAIN_VARIANT (t)); + if (!same) break; + } - type_stringifier stringifier; - _type_collector.ptrset2.records.add (TYPE_MAIN_VARIANT (t)); + if (!same) { + ptrset3->add (TYPE_MAIN_VARIANT (t)); } } diff --git a/gcc/ipa-type-escape-analysis.h b/gcc/ipa-type-escape-analysis.h index 702e13e62ba..d33d1c4e923 100644 --- a/gcc/ipa-type-escape-analysis.h +++ b/gcc/ipa-type-escape-analysis.h @@ -438,9 +438,6 @@ struct type_partitions2_s /* The set of all non escaping types. */ tset2_t non_escaping; - /* The set of all records. */ - tset2_t records; - /* Determine if we have seen this type before. */ bool in_universe (tree); @@ -465,7 +462,11 @@ class type_collector : public type_walker public: type_collector (tpartitions2_t &ptrset) : ptrset2(ptrset) - {}; + { + }; + ~type_collector() + { + }; /* Main interface. */ void collect (tree t); @@ -645,8 +646,14 @@ class expr_collector : public expr_walker { public: expr_collector (tpartitions2_t &p) - : _type_collector (p) - {}; + : _type_collector (p), ptrset3(NULL) + { + ptrset3 = new hash_set<tree>(); + }; + ~expr_collector () + { + delete ptrset3; + }; /* Holds the result after collecting from all trees. */ tpartitions2_t get_record_reaching_trees () @@ -654,6 +661,7 @@ public: return _type_collector.get_record_reaching_trees (); } + hash_set<tree> *ptrset3; type_collector _type_collector; private: @@ -731,7 +739,7 @@ public: } unsigned int how_many_records = - _expr_collector._type_collector.ptrset2.records.elements (); + _expr_collector.ptrset3->elements (); return how_many_records <= 1; } |