diff options
author | Martin Liska <mliska@suse.cz> | 2017-08-30 14:38:31 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2017-08-30 12:38:31 +0000 |
commit | 6cc30cb4ff182583ffbebe9819973b5b693322fd (patch) | |
tree | 7aa4046e7e1ba187d40f28ab3b802965c1bb0c48 /gcc/ipa-icf-gimple.c | |
parent | 357b7604e55516bd3e1f44d1670d2248478a9b57 (diff) |
Fix IPA ICF with ASM statements (PR inline-asm/82001).
2017-08-30 Martin Liska <mliska@suse.cz>
PR inline-asm/82001
* ipa-icf-gimple.c (func_checker::compare_tree_list_operand):
Rename to ...
(func_checker::compare_asm_inputs_outputs): ... this function.
(func_checker::compare_gimple_asm): Use the function to compare
also ASM constrains.
* ipa-icf-gimple.h: Rename the function.
2017-08-30 Martin Liska <mliska@suse.cz>
PR inline-asm/82001
* gcc.dg/ipa/pr82001.c: New test.
From-SVN: r251530
Diffstat (limited to 'gcc/ipa-icf-gimple.c')
-rw-r--r-- | gcc/ipa-icf-gimple.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c index f44a995f580..b40dd8653b4 100644 --- a/gcc/ipa-icf-gimple.c +++ b/gcc/ipa-icf-gimple.c @@ -543,11 +543,8 @@ func_checker::compare_operand (tree t1, tree t2) } } -/* Compares two tree list operands T1 and T2 and returns true if these - two trees are semantically equivalent. */ - bool -func_checker::compare_tree_list_operand (tree t1, tree t2) +func_checker::compare_asm_inputs_outputs (tree t1, tree t2) { gcc_assert (TREE_CODE (t1) == TREE_LIST); gcc_assert (TREE_CODE (t2) == TREE_LIST); @@ -560,6 +557,16 @@ func_checker::compare_tree_list_operand (tree t1, tree t2) if (!compare_operand (TREE_VALUE (t1), TREE_VALUE (t2))) return return_false (); + tree p1 = TREE_PURPOSE (t1); + tree p2 = TREE_PURPOSE (t2); + + gcc_assert (TREE_CODE (p1) == TREE_LIST); + gcc_assert (TREE_CODE (p2) == TREE_LIST); + + if (strcmp (TREE_STRING_POINTER (TREE_VALUE (p1)), + TREE_STRING_POINTER (TREE_VALUE (p2))) != 0) + return return_false (); + t2 = TREE_CHAIN (t2); } @@ -1008,7 +1015,7 @@ func_checker::compare_gimple_asm (const gasm *g1, const gasm *g2) tree input1 = gimple_asm_input_op (g1, i); tree input2 = gimple_asm_input_op (g2, i); - if (!compare_tree_list_operand (input1, input2)) + if (!compare_asm_inputs_outputs (input1, input2)) return return_false_with_msg ("ASM input is different"); } @@ -1017,7 +1024,7 @@ func_checker::compare_gimple_asm (const gasm *g1, const gasm *g2) tree output1 = gimple_asm_output_op (g1, i); tree output2 = gimple_asm_output_op (g2, i); - if (!compare_tree_list_operand (output1, output2)) + if (!compare_asm_inputs_outputs (output1, output2)) return return_false_with_msg ("ASM output is different"); } |