diff options
author | Erick Ochoa <erick.ochoa@theobroma-systems.com> | 2020-06-17 17:36:28 +0200 |
---|---|---|
committer | Erick Ochoa <erick.ochoa@theobroma-systems.com> | 2020-06-17 17:36:28 +0200 |
commit | 1ea9a204ef32fc5c3e1636c003ac68bd32cc2723 (patch) | |
tree | 2997c24c2e05fbf9928cd5119e17ec1d4120a9b6 | |
parent | 2096c9d2a40a138e5d388d06b1c04839ac1fb91f (diff) |
more pointer arithmetic
-rw-r--r-- | gcc/expr-rewriter.c | 145 | ||||
-rw-r--r-- | gcc/expr-rewriter.hpp | 13 | ||||
-rw-r--r-- | gcc/gimple-accesser.c | 1 | ||||
-rw-r--r-- | gcc/gimple-rewriter.c | 59 | ||||
-rw-r--r-- | gcc/gimple-rewriter.hpp | 1 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/ipa/ipa-structreorg-20-array-offset-0.c | 17 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/ipa/ipa-structreorg-21-rewrites-clobber-type-0.c | 17 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/ipa/ipa-structreorg-22-rewrites-addr-expr-read-0.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/ipa/ipa-structreorg-23-array-cast-0.c | 23 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/ipa/ipa-structreorg-24-array-cast-0.c | 31 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/ipa/ipa-structreorg-25-array-cast-0.c | 12 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/ipa/ipa-structreorg-26-array-cast-0.c | 14 | ||||
-rw-r--r-- | gcc/type-reconstructor.c | 7 |
13 files changed, 255 insertions, 89 deletions
diff --git a/gcc/expr-rewriter.c b/gcc/expr-rewriter.c index 6ea2b42c580..f0e517662ba 100644 --- a/gcc/expr-rewriter.c +++ b/gcc/expr-rewriter.c @@ -3,9 +3,154 @@ #include <string> #include <map> +bool +ExprTypeRewriter::is_interesting_type(tree t) +{ + const bool in_imap = _imap.find(t) != _imap.end(); + bool interesting = in_imap; + if (!interesting) return false; + + tree possibly_copy = (tree)_imap[t]; + const bool is_copy = possibly_copy == t; + interesting = !is_copy; + if (!interesting) return false; + + // Let's just do a quick sanity check + tree interesting_type = t; + const bool has_valid_suffix = strstr(TypeStringifier::get_type_identifier(interesting_type).c_str(), ".reorg"); + gcc_assert(has_valid_suffix); + return true; +} + +void +ExprTypeRewriter::handle_pointer_arithmetic_nonconstant(gimple *s, tree op_0, tree op_1) +{ + // _1 = _0 * 72 + // ... SNIP ... + // _2 = _1 + CONSTANT; + // ... SNIP ... + // _3 = &array + _2; < -- this is where we are + //enum tree_code code = TREE_CODE(op_1); + //assert_is_type(op_1, SSA_NAME); + + gimple *def_for_variable = SSA_NAME_DEF_STMT(op_1); + // It is possible that we are in a negation statement... + // Example: + // _2 = _1 * 72; + // ... SNIP ... + // _3 = -_2; < -- def_for_variable **might** be this stmt. + // ... SNIP ... + // _4 = &array + _3; + // Let's find out how many operands we have + unsigned num_operands = gimple_num_ops(def_for_variable); + // Here operands is kind of a minomer. + // operand 0 is the lhs + // operand 1 is the rhs + // I.e. lhs = (unary_operator) rhs; + const bool get_another_definition = num_operands == 2; + tree possibly_not_needed = get_another_definition ? gimple_op (def_for_variable, 1) : NULL; + def_for_variable = get_another_definition ? SSA_NAME_DEF_STMT(possibly_not_needed) : def_for_variable; + + // Example: + // _2 = _1 * 72; <-- Now we are here... + // ... SNIP ... + // _3 = -_2; + // ... SNIP ... + // _4 = &array + _3; + + enum tree_code code = gimple_expr_code (def_for_variable); + const bool is_mult_expr = MULT_EXPR == code; + bool is_valid_input = is_mult_expr; + gcc_assert(is_valid_input); + + tree op_0_earlier = gimple_assign_rhs1(def_for_variable); + tree op_1_earlier = gimple_assign_rhs2(def_for_variable); + + // We should be able to just call the constant implementation + //handle_pointer_arithmetic_constants(def_for_variable, op_0, op_1); + //However... + //these variables no longer hold the type needed for them to change correctly + //so, let's do it from here... + + assert_is_type(op_1_earlier, INTEGER_CST); + + // op_0 is the variable + // That means that the reorg_type is + tree reorg_type_tree = TREE_TYPE(op_0); + tree reorg_inner_type = TREE_TYPE(reorg_type_tree); + tree reorg_type_size_tree = TYPE_SIZE_UNIT(reorg_inner_type); + int reorg_type_size_int = tree_to_shwi(reorg_type_size_tree); + // That means that the old type is + tree old_type_tree = (tree)_imap[reorg_type_tree]; + tree old_inner_type = TREE_TYPE(old_type_tree); + tree old_type_size_tree = TYPE_SIZE_UNIT(old_inner_type); + int old_type_size_int = tree_to_shwi(old_type_size_tree); + + tree old_integer_cst_tree = op_1_earlier; + int old_integer_cst_int = tree_to_uhwi(old_integer_cst_tree); + + int offset = old_integer_cst_int % old_type_size_int ; + int new_integer_cst_int = old_integer_cst_int / old_type_size_int * reorg_type_size_int + offset; + log("%d = %d / %d * %d + %d\n", new_integer_cst_int, old_integer_cst_int, old_type_size_int, reorg_type_size_int, offset); + + tree new_integer_cst_tree = build_int_cst(TREE_TYPE(old_integer_cst_tree), new_integer_cst_int); + gimple_set_op(def_for_variable, 2, new_integer_cst_tree); +} + +void +ExprTypeRewriter::handle_pointer_arithmetic_constants(gimple *s, tree p, tree i) +{ + // So, because we have already changed the type + // tree p will either be the original type + // if we do not need to modify this expression + // How do we know if we have an original type? + // It is when we don't have a type in our map + tree possibly_reorged_type = TREE_TYPE(p); + bool is_interesting_case = is_interesting_type(possibly_reorged_type); + if (!is_interesting_case) return; + + tree reorg_type = possibly_reorged_type; // this is the type of the variable + const_tree original_type = _imap[reorg_type]; + // If we are here, that means that our type has the ".reorg" suffix + const bool has_suffix = strstr(TypeStringifier::get_type_identifier(reorg_type).c_str(), ".reorg"); + bool is_valid_input = has_suffix; + gcc_assert(is_valid_input); + + // We need to know what size is the previous original type + tree inner_reorg_type = TREE_TYPE(reorg_type); + tree inner_orig_type = TREE_TYPE(original_type); + tree old_size_tree = TYPE_SIZE_UNIT(inner_orig_type); + int old_size_int = tree_to_shwi(old_size_tree); + tree new_size_tree = TYPE_SIZE_UNIT(inner_reorg_type); + int new_size_int = tree_to_shwi(new_size_tree); + tree old_integer_cst_tree = i; + int old_integer_cst_int = tree_to_uhwi(old_integer_cst_tree); + + int offset = old_integer_cst_int % old_size_int; + const bool is_modulo = offset == 0; + is_valid_input = is_modulo; + gcc_assert(is_valid_input); + + int new_integer_cst_int = old_integer_cst_int / old_size_int * new_size_int + offset; + log("%d = %d / %d * %d\n", new_integer_cst_int, old_integer_cst_int, old_size_int, new_size_int); + + tree new_integer_cst_tree = build_int_cst(TREE_TYPE(old_integer_cst_tree), new_integer_cst_int); + gimple_set_op(s, 2, new_integer_cst_tree); + + +} + void ExprTypeRewriter::_walk_post(const_tree e) { + const enum tree_code code = TREE_CODE(e); + log("tree_code_name = %s\n", get_tree_code_name(code)); + + if(dump_file) { + print_generic_expr(dump_file, (tree)e); + log("\n"); + } + gcc_assert(e); tree t = TREE_TYPE(e); const bool in_map = _map.find(t) != _map.end(); diff --git a/gcc/expr-rewriter.hpp b/gcc/expr-rewriter.hpp index 48fcaeda8a0..5893f4970ae 100644 --- a/gcc/expr-rewriter.hpp +++ b/gcc/expr-rewriter.hpp @@ -6,10 +6,21 @@ class ExprTypeRewriter : public ExprWalker { public: - ExprTypeRewriter(TypeReconstructor::reorg_record_map_t map, TypeReconstructor::reorg_field_map_t map2) : _map(map), _map2(map2) {}; + ExprTypeRewriter(TypeReconstructor::reorg_record_map_t map, TypeReconstructor::reorg_field_map_t map2) : _map(map), _map2(map2) { + for (auto i = map.cbegin(), e = map.cend(); i != e; ++i) + { + const_tree original = i->first; + tree modified = i->second; + _imap[modified] = original; + } + }; + void handle_pointer_arithmetic_constants(gimple *s, tree p, tree i); + void handle_pointer_arithmetic_nonconstant(gimple *s, tree p, tree i); + bool is_interesting_type(tree); private: TypeReconstructor::reorg_record_map_t _map; TypeReconstructor::reorg_field_map_t _map2; + std::map<tree, const_tree> _imap; void _walk_post(const_tree e); void _walk_COMPONENT_REF_post(const_tree e); }; diff --git a/gcc/gimple-accesser.c b/gcc/gimple-accesser.c index 7c1bd51f6cb..18d74f499c0 100644 --- a/gcc/gimple-accesser.c +++ b/gcc/gimple-accesser.c @@ -60,7 +60,6 @@ GimpleAccesser::_walk_pre(gassign *s) exprAccessor.update(rhs1, Read); const_tree lhs = gimple_assign_lhs(s); if (!lhs) break; - log("in lhs gimple-accessor\n"); exprAccessor.update(lhs, Write); break; } diff --git a/gcc/gimple-rewriter.c b/gcc/gimple-rewriter.c index 28e0d5f6841..ce482fb90a9 100644 --- a/gcc/gimple-rewriter.c +++ b/gcc/gimple-rewriter.c @@ -24,9 +24,57 @@ GimpleTypeRewriter::_walk_pre(greturn *s) } void +GimpleTypeRewriter::handle_pointer_arithmetic(gimple *s) +{ + const enum tree_code p = POINTER_PLUS_EXPR; + const enum tree_code d = POINTER_DIFF_EXPR; + const enum tree_code e = gimple_expr_code(s); + const bool is_pointer_plus = p == e; + const bool is_pointer_diff = d == e; + bool is_valid_input = is_pointer_plus != is_pointer_diff; + gcc_assert(is_valid_input); + // TODO: Implement pointer diff + if (!is_pointer_plus) return; + + const enum gimple_rhs_class rhs_class = gimple_assign_rhs_class(s); + is_valid_input = GIMPLE_BINARY_RHS == rhs_class; + gcc_assert(is_valid_input); + + tree op_0 = gimple_assign_rhs1(s); + tree op_1 = gimple_assign_rhs2(s); + tree op_0_t = TREE_TYPE(op_0); + tree op_1_t = TREE_TYPE(op_1); + const bool is_op_0_t_interesting = exprTypeRewriter.is_interesting_type(op_0_t); + const bool is_op_1_t_interesting = exprTypeRewriter.is_interesting_type(op_1_t); + bool is_interesting_case = is_op_0_t_interesting || is_op_1_t_interesting; + if (!is_interesting_case) return; + + const enum tree_code op_1_code = TREE_CODE(op_1); + const enum tree_code op_0_code = TREE_CODE(op_0); + const bool is_op_0_icst = INTEGER_CST == op_0_code; + const bool is_op_1_icst = INTEGER_CST == op_1_code; + const bool is_constant_case = is_op_0_icst != is_op_1_icst; + if (!is_constant_case) + { + exprTypeRewriter.handle_pointer_arithmetic_nonconstant(s, op_0, op_1); + return; + } + + tree integer_constant = is_op_0_icst ? op_0 : op_1; + tree maybe_pointer = is_op_0_icst ? op_1 : op_0; + const_tree maybe_pointer_t = TREE_TYPE(maybe_pointer); + assert_is_type(maybe_pointer_t, POINTER_TYPE); + tree pointer_variable = maybe_pointer; + + exprTypeRewriter.handle_pointer_arithmetic_constants(s, pointer_variable, integer_constant); +} + + +void GimpleTypeRewriter::_walk_pre(gassign *s) { const enum gimple_rhs_class code = gimple_assign_rhs_class(s); + switch (code) { case GIMPLE_TERNARY_RHS: @@ -56,6 +104,17 @@ GimpleTypeRewriter::_walk_pre(gassign *s) break; } + const enum tree_code e_code = gimple_expr_code(s); + switch (e_code) + { + case POINTER_PLUS_EXPR: + case POINTER_DIFF_EXPR: + handle_pointer_arithmetic(s); + break; + default: + break; + } + } void diff --git a/gcc/gimple-rewriter.hpp b/gcc/gimple-rewriter.hpp index 67894485a27..1b9ec6bd0c6 100644 --- a/gcc/gimple-rewriter.hpp +++ b/gcc/gimple-rewriter.hpp @@ -10,6 +10,7 @@ public: GimpleTypeRewriter(TypeReconstructor::reorg_record_map_t map, TypeReconstructor::reorg_field_map_t map2) : exprTypeRewriter(map, map2) {}; private: ExprTypeRewriter exprTypeRewriter; + void handle_pointer_arithmetic(gimple *s); virtual void _walk_pre(const_tree) final; virtual void _walk_pre(gimple*) final; virtual void _walk_pre(gcall *s) final; diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-20-array-offset-0.c b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-20-array-offset-0.c index f93b642586e..d9f0ac13b55 100644 --- a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-20-array-offset-0.c +++ b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-20-array-offset-0.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-flto -flto-partition=none -fipa-dead-field-eliminate -fdump-ipa-structure-reorg -fipa-typelist-field=b -fipa-typelist-struct=astruct_s" } */ +/* { dg-options "-flto -fipa-type-escape-analysis -fdump-ipa-type-escape-analysis " } */ #include <assert.h> @@ -13,11 +13,12 @@ main () _Bool c; }; struct astruct_s b[2]; - _Bool *first_of_second = &(b[1].a); - _Bool *a_ptr = &(b[0].a); - _Bool *c_from_a = ++a_ptr; - _Bool *c_from_array = --first_of_second; - _Bool test = c_from_a == c_from_array; - assert (test); - char compile_test[test ? 1 : -1]; + _Bool *a_0_ptr = &(b[0].a); + _Bool *c_0_ptr = &(b[0].c); + _Bool *a_1_ptr = &(b[1].a); + + _Bool *c_0_ptr_from_a_0_ptr = a_0_ptr + 1; + _Bool *c_0_ptr_from_a_1_ptr = a_1_ptr - 1; + assert(c_0_ptr_from_a_0_ptr == c_0_ptr); + assert(c_0_ptr_from_a_1_ptr == c_0_ptr); } diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-21-rewrites-clobber-type-0.c b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-21-rewrites-clobber-type-0.c deleted file mode 100644 index 080d8509c26..00000000000 --- a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-21-rewrites-clobber-type-0.c +++ /dev/null @@ -1,17 +0,0 @@ -/* { dg-do run } */ -/* { dg-options "-flto -flto-partition=none -fipa-dead-field-eliminate -fdump-ipa-structure-reorg -fipa-typelist-field=b -fipa-typelist-struct=astruct_s" } */ - -int -main () -{ - struct astruct_s - { - _Bool a; - _Bool b; - _Bool c; - }; - struct astruct_s astruct; - return 0; -} - -// CLOBBERS :( diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-22-rewrites-addr-expr-read-0.c b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-22-rewrites-addr-expr-read-0.c index 68c75427640..869d2b622e0 100644 --- a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-22-rewrites-addr-expr-read-0.c +++ b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-22-rewrites-addr-expr-read-0.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-flto -flto-partition=none -fipa-dead-field-eliminate -fdump-ipa-structure-reorg -fipa-typelist-field=b -fipa-typelist-struct=astruct_s" } */ +/* { dg-options "-flto -fipa-type-escape-analysis -fdump-ipa-type-escape-analysis " } */ #include <assert.h> @@ -16,6 +16,8 @@ main () _Bool *a = &astruct.a; _Bool *c = &astruct.c; _Bool *c_1 = a + 1; + _Bool *a_1 = c - 1; assert (c_1 == c); + assert (a_1 == a); return 0; } diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-23-array-cast-0.c b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-23-array-cast-0.c index c86bce1f885..a4b1c516fb1 100644 --- a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-23-array-cast-0.c +++ b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-23-array-cast-0.c @@ -1,9 +1,10 @@ /* { dg-do run } */ -/* { dg-options "-flto -flto-partition=none -fipa-dead-field-eliminate -fdump-ipa-structure-reorg -fipa-typelist-field=b -fipa-typelist-struct=astruct_s" } */ +/* { dg-options "-flto -fipa-type-escape-analysis -fdump-ipa-type-escape-analysis " } */ #include <assert.h> #include <stdio.h> #include <stddef.h> +#include <stdio.h> int main () @@ -15,14 +16,16 @@ main () _Bool c; }; struct astruct_s a[2]; - struct bstruct_s - { - _Bool a; - _Bool c; - }; struct astruct_s *a_0 = &(a[0]); - struct astruct_s *a_1 = a_0 + 1; - struct bstruct_s *b_0 = (struct bstruct_s *) a_0; - struct bstruct_s *b_1 = b_0 + 1; - assert ((struct bstruct_s *) a_1 == b_1); + struct astruct_s *a_1 = &(a[1]); + struct astruct_s *a_1_from_a_0 = a_0 + 1; + printf("%d %d\n", a_0->a, a_0->c); + // old new + // 0 a a + // 1 b c + // 2 c a + // 3 a c + // 4 b a + // 5 c c + assert(a_1 == a_1_from_a_0); } diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-24-array-cast-0.c b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-24-array-cast-0.c deleted file mode 100644 index f42acd18d93..00000000000 --- a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-24-array-cast-0.c +++ /dev/null @@ -1,31 +0,0 @@ -/* { dg-do run } */ -/* { dg-options "-flto -flto-partition=none -fipa-dead-field-eliminate -fdump-ipa-structure-reorg -fipa-typelist-field=b -fipa-typelist-struct=astruct_s" } */ - -#include <assert.h> -#include <stdio.h> -#include <stddef.h> - -int -main () -{ - struct astruct_s - { - _Bool a; - _Bool b; - _Bool c; - _Bool d; - }; - struct astruct_s a[2]; - struct bstruct_s - { - _Bool a; - _Bool c; - _Bool d; - }; - - struct astruct_s *a_0 = &(a[0]); - struct astruct_s *a_1 = a_0 + 1; - struct bstruct_s *b_0 = (struct bstruct_s *) a_0; - struct bstruct_s *b_1 = b_0 + 1; - assert ((struct bstruct_s *) a_1 == b_1); -} diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-25-array-cast-0.c b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-25-array-cast-0.c index ef4c1c10772..bf867b6cd43 100644 --- a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-25-array-cast-0.c +++ b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-25-array-cast-0.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-flto -flto-partition=none -fipa-dead-field-eliminate -fdump-ipa-structure-reorg -fipa-typelist-field=b -fipa-typelist-struct=astruct_s" } */ +/* { dg-options "-flto -fipa-type-escape-analysis -fdump-ipa-type-escape-analysis" } */ #include <assert.h> #include <stdio.h> @@ -23,9 +23,9 @@ main () _Bool d; }; - struct astruct_s *a_0 = &(a[1]); - struct astruct_s *a_1 = a_0 - 1; - struct bstruct_s *b_0 = (struct bstruct_s *) a_0; - struct bstruct_s *b_1 = b_0 - 1; - assert ((struct bstruct_s *) a_1 == b_1); + struct astruct_s *a_1 = &(a[1]); + struct astruct_s *a_0 = a_1 - 1; + struct bstruct_s *b_1 = (struct bstruct_s *) a_1; + struct bstruct_s *b_0 = b_1 - 1; + assert ((struct bstruct_s *) a_0 != b_0); } diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-26-array-cast-0.c b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-26-array-cast-0.c index 7ec3c82a916..5d1cb281c76 100644 --- a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-26-array-cast-0.c +++ b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-26-array-cast-0.c @@ -16,16 +16,10 @@ main (int argc, char **argv) _Bool d; }; struct astruct_s a[2]; - struct bstruct_s - { - _Bool a; - _Bool c; - _Bool d; - }; - struct astruct_s *a_0 = &(a[0]); struct astruct_s *a_1 = a_0 + argc; - struct bstruct_s *b_0 = (struct bstruct_s *) a_0; - struct bstruct_s *b_1 = b_0 + argc; - assert ((struct bstruct_s *) a_1 == b_1); + ptrdiff_t d = a_1 - a_0; + printf("%d %d %d\n", a_0->a, a_0->c, a_0->d); + printf("%d\n", d); + } diff --git a/gcc/type-reconstructor.c b/gcc/type-reconstructor.c index 26796eacf2b..ed46f21630a 100644 --- a/gcc/type-reconstructor.c +++ b/gcc/type-reconstructor.c @@ -45,12 +45,12 @@ TypeReconstructor::set_is_not_modified_yet(const_tree t) if (!tt) return; const bool is_in_reorg_map_2 = _reorg_map.find(tt) != _reorg_map.end(); + log ("is in reorg_map_2 ? %s\n", is_in_reorg_map_2 ? "t" : "f"); if (!is_in_reorg_map_2) return; - log("is in reorg map\n"); tree type = _reorg_map[tt]; - log("name = %s\n", TypeStringifier::get_type_identifier(type).c_str()); const bool is_modified = strstr(TypeStringifier::get_type_identifier(type).c_str(), ".reorg"); + log("is modified %s\n", is_modified ? "t" : "f"); if (!is_modified) return; mark_all_pointing_here_as_modified(); @@ -137,7 +137,6 @@ TypeReconstructor::_walk_ARRAY_TYPE_post(const_tree t) bool is_modified = get_is_modified(t); copy = is_modified ? build_distinct_type_copy(copy) : copy; - log("array is modified ? %s\n", is_modified ? "t" : "f"); TREE_TYPE(copy) = is_modified ? _reorg_map[TREE_TYPE(t)] : TREE_TYPE(copy); TYPE_NAME(copy) = is_modified ? get_new_identifier(copy) : TYPE_NAME(copy); // This is useful so that we go again through type layout @@ -169,6 +168,7 @@ TypeReconstructor::_walk_POINTER_TYPE_post(const_tree t) bool is_modified = get_is_modified(t); copy = is_modified ? build_distinct_type_copy(copy) : copy; + TREE_TYPE(copy) = is_modified ? _reorg_map[TREE_TYPE(t)] : TREE_TYPE(copy); TYPE_NAME(copy) = is_modified ? get_new_identifier(copy) : TYPE_NAME(copy); // This is useful so that we go again through type layout TYPE_SIZE(copy) = is_modified ? NULL : TYPE_SIZE(copy); @@ -306,7 +306,6 @@ TypeReconstructor::_walk_field_post(const_tree t) unsigned f_bit_offset = tree_to_uhwi(DECL_FIELD_BIT_OFFSET(t)); unsigned f_offset = 8 * f_byte_offset + f_bit_offset; - const bool can_field_be_deleted = field_offsets.find(f_offset) != field_offsets.end(); if (can_field_be_deleted) mark_all_pointing_here_as_modified(); const_tree original_type = TREE_TYPE(t); |