diff options
author | Erick Ochoa <erick.ochoa@theobroma-systems.com> | 2020-02-21 19:17:44 +0100 |
---|---|---|
committer | Erick Ochoa <erick.ochoa@theobroma-systems.com> | 2020-05-14 14:45:36 +0200 |
commit | ed1dd87f24093b12fe7aaea73941d0e4a1323fc1 (patch) | |
tree | d65ecd3917b90931d5a742e4e12fe7272612e0d5 /gcc/ipa-str-reorg-dead-field-eliminate.c | |
parent | 0e0d64253b708688fe6c5737c9a939ef89158099 (diff) |
Fixes warning
Diffstat (limited to 'gcc/ipa-str-reorg-dead-field-eliminate.c')
-rw-r--r-- | gcc/ipa-str-reorg-dead-field-eliminate.c | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/gcc/ipa-str-reorg-dead-field-eliminate.c b/gcc/ipa-str-reorg-dead-field-eliminate.c index a7a237b338b..a72ddc1452d 100644 --- a/gcc/ipa-str-reorg-dead-field-eliminate.c +++ b/gcc/ipa-str-reorg-dead-field-eliminate.c @@ -2016,73 +2016,6 @@ rewrite_pointer_plus_def_rhs_variable_replace_constants_implementation ( } static tree -rewrite_pointer_diff_def_rhs_variable (gimple_stmt_iterator &gsi, tree lhs, - tree op0, tree op1, const_tree old_type) -{ - tree pointer_type = TREE_TYPE (op0); - gcc_assert (TREE_CODE (pointer_type) == POINTER_TYPE); - enum tree_code code = TREE_CODE (op1); - gcc_assert (TREE_CODE (op1) == SSA_NAME); - tree variable_type = TREE_TYPE (op1); - gcc_assert (TREE_CODE (TREE_TYPE (lhs)) == INTEGER_TYPE); - const_tree old_base_type = TREE_TYPE (old_type); - tree old_struct_size_tree_1 = TYPE_SIZE_UNIT (old_base_type); - int old_struct_size_int = tree_to_shwi (old_struct_size_tree_1); - const_tree new_base_type = TREE_TYPE (TREE_TYPE (op0)); - tree new_struct_size_tree_1 = TYPE_SIZE_UNIT (new_base_type); - int new_struct_size_int = tree_to_shwi (new_struct_size_tree_1); - - test_log ("old_struct_size_int = %d", 0, old_struct_size_int); - test_log ("new_struct_size_int = %d", 0, new_struct_size_int); - // avoid modifications - if (old_struct_size_int == new_struct_size_int) - return NULL; - - // the variable holds the offset without multiplication by type size - // lhs = op0 - op1 <-- we are here - // _next = lhs / old_size - // - // What we want: - // lhs = op0 - op1 - // tmpvar = lhs * old_size - // tmpvar2 = tmpvar / new_size - // _next = tmpvar2 / old_size - // - // Let's first create a temporary variable - // tmpvar = lhs * old_size - tree tmpvar = create_tmp_var (TREE_TYPE (lhs)); - // Good. - // Now, we can make an integer constant - // that is old_struct_size; - // tmpvar = lhs * old_size - - tree old_struct_size = build_int_cst (TREE_TYPE (lhs), old_struct_size_int); - // Good. - // Now we need to create a mult operation between the two - // Because there is no pointer division. - gassign *assign_stmt_1 - = gimple_build_assign (tmpvar, MULT_EXPR, lhs, old_struct_size); - - // Ok now we need a new temporary variable - // tmpvar2 = tmpvar / new_size - tree tmpvar2 = create_tmp_var (TREE_TYPE (lhs)); - // Good. - // Now we need we need another integer constant - tree new_struct_size = build_int_cst (TREE_TYPE (lhs), new_struct_size_int); - - // Good. Now we need to divide... - // tmpvar2 = tmpvar / new_size - gassign *assign_stmt_2 - = gimple_build_assign (tmpvar2, EXACT_DIV_EXPR, tmpvar, new_struct_size); - - // Now we need to insert assign_stmt_1 after us... - gsi_insert_after (&gsi, assign_stmt_1, GSI_NEW_STMT); - // Now we need to insert assign_stmt_2 after us... - gsi_insert_after (&gsi, assign_stmt_2, GSI_NEW_STMT); - return tmpvar2; -} - -static tree rewrite_pointer_plus_def_rhs_integer_constant (tree pointer, tree integer_constant, const_tree old_type) |