1 /* Interprocedural Identical Code Folding pass
2 Copyright (C) 2014-2020 Free Software Foundation, Inc.
4 Contributed by Jan Hubicka <hubicka@ucw.cz> and Martin Liska <mliska@suse.cz>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
24 #include "coretypes.h"
29 #include "tree-pass.h"
32 #include "data-streamer.h"
33 #include "gimple-pretty-print.h"
34 #include "fold-const.h"
35 #include "gimple-iterator.h"
36 #include "ipa-utils.h"
42 #include "ipa-icf-gimple.h"
44 namespace ipa_icf_gimple
{
46 /* Initialize internal structures for a given SOURCE_FUNC_DECL and
47 TARGET_FUNC_DECL. Strict polymorphic comparison is processed if
48 an option COMPARE_POLYMORPHIC is true. For special cases, one can
49 set IGNORE_LABELS to skip label comparison.
50 Similarly, IGNORE_SOURCE_DECLS and IGNORE_TARGET_DECLS are sets
51 of declarations that can be skipped. */
53 func_checker::func_checker (tree source_func_decl
, tree target_func_decl
,
55 hash_set
<symtab_node
*> *ignored_source_nodes
,
56 hash_set
<symtab_node
*> *ignored_target_nodes
)
57 : m_source_func_decl (source_func_decl
), m_target_func_decl (target_func_decl
),
58 m_ignored_source_nodes (ignored_source_nodes
),
59 m_ignored_target_nodes (ignored_target_nodes
),
60 m_ignore_labels (ignore_labels
)
62 function
*source_func
= DECL_STRUCT_FUNCTION (source_func_decl
);
63 function
*target_func
= DECL_STRUCT_FUNCTION (target_func_decl
);
65 unsigned ssa_source
= SSANAMES (source_func
)->length ();
66 unsigned ssa_target
= SSANAMES (target_func
)->length ();
68 m_source_ssa_names
.create (ssa_source
);
69 m_target_ssa_names
.create (ssa_target
);
71 for (unsigned i
= 0; i
< ssa_source
; i
++)
72 m_source_ssa_names
.safe_push (-1);
74 for (unsigned i
= 0; i
< ssa_target
; i
++)
75 m_target_ssa_names
.safe_push (-1);
78 /* Memory release routine. */
80 func_checker::~func_checker ()
82 m_source_ssa_names
.release();
83 m_target_ssa_names
.release();
86 /* Verifies that trees T1 and T2 are equivalent from perspective of ICF. */
89 func_checker::compare_ssa_name (const_tree t1
, const_tree t2
)
91 gcc_assert (TREE_CODE (t1
) == SSA_NAME
);
92 gcc_assert (TREE_CODE (t2
) == SSA_NAME
);
94 unsigned i1
= SSA_NAME_VERSION (t1
);
95 unsigned i2
= SSA_NAME_VERSION (t2
);
97 if (m_source_ssa_names
[i1
] == -1)
98 m_source_ssa_names
[i1
] = i2
;
99 else if (m_source_ssa_names
[i1
] != (int) i2
)
102 if(m_target_ssa_names
[i2
] == -1)
103 m_target_ssa_names
[i2
] = i1
;
104 else if (m_target_ssa_names
[i2
] != (int) i1
)
107 if (SSA_NAME_IS_DEFAULT_DEF (t1
))
109 tree b1
= SSA_NAME_VAR (t1
);
110 tree b2
= SSA_NAME_VAR (t2
);
112 return compare_operand (b1
, b2
);
118 /* Verification function for edges E1 and E2. */
121 func_checker::compare_edge (edge e1
, edge e2
)
123 if (e1
->flags
!= e2
->flags
)
128 edge
&slot
= m_edge_map
.get_or_insert (e1
, &existed_p
);
130 return return_with_debug (slot
== e2
);
134 /* TODO: filter edge probabilities for profile feedback match. */
139 /* Verification function for declaration trees T1 and T2 that
140 come from functions FUNC1 and FUNC2. */
143 func_checker::compare_decl (const_tree t1
, const_tree t2
)
145 if (!auto_var_in_fn_p (t1
, m_source_func_decl
)
146 || !auto_var_in_fn_p (t2
, m_target_func_decl
))
147 return return_with_debug (t1
== t2
);
149 tree_code t
= TREE_CODE (t1
);
150 if ((t
== VAR_DECL
|| t
== PARM_DECL
|| t
== RESULT_DECL
)
151 && DECL_BY_REFERENCE (t1
) != DECL_BY_REFERENCE (t2
))
152 return return_false_with_msg ("DECL_BY_REFERENCE flags are different");
154 if (!compatible_types_p (TREE_TYPE (t1
), TREE_TYPE (t2
)))
155 return return_false ();
158 const_tree
&slot
= m_decl_map
.get_or_insert (t1
, &existed_p
);
160 return return_with_debug (slot
== t2
);
167 /* Return true if T1 and T2 are same for purposes of ipa-polymorphic-call
168 analysis. COMPARE_PTR indicates if types of pointers needs to be
172 func_checker::compatible_polymorphic_types_p (tree t1
, tree t2
,
175 gcc_assert (TREE_CODE (t1
) != FUNCTION_TYPE
&& TREE_CODE (t1
) != METHOD_TYPE
);
177 /* Pointer types generally give no information. */
178 if (POINTER_TYPE_P (t1
))
182 return func_checker::compatible_polymorphic_types_p (TREE_TYPE (t1
),
187 /* If types contain a polymorphic types, match them. */
188 bool c1
= contains_polymorphic_type_p (t1
);
189 bool c2
= contains_polymorphic_type_p (t2
);
193 return return_false_with_msg ("one type is not polymorphic");
194 if (!types_must_be_same_for_odr (t1
, t2
))
195 return return_false_with_msg ("types are not same for ODR");
199 /* Return true if types are compatible from perspective of ICF. */
201 func_checker::compatible_types_p (tree t1
, tree t2
)
203 if (TREE_CODE (t1
) != TREE_CODE (t2
))
204 return return_false_with_msg ("different tree types");
206 if (TYPE_RESTRICT (t1
) != TYPE_RESTRICT (t2
))
207 return return_false_with_msg ("restrict flags are different");
209 if (!types_compatible_p (t1
, t2
))
210 return return_false_with_msg ("types are not compatible");
215 /* Function compare for equality given trees T1 and T2 which
216 can be either a constant or a declaration type. */
219 func_checker::hash_operand (const_tree arg
, inchash::hash
&hstate
,
222 if (arg
== NULL_TREE
)
224 hstate
.merge_hash (0);
228 switch (TREE_CODE (arg
))
239 inchash::add_expr (DECL_FIELD_OFFSET (arg
), hstate
, flags
);
240 inchash::add_expr (DECL_FIELD_BIT_OFFSET (arg
), hstate
, flags
);
246 return operand_compare::hash_operand (arg
, hstate
, flags
);
250 func_checker::operand_equal_p (const_tree t1
, const_tree t2
,
254 if (verify_hash_value (t1
, t2
, flags
, &r
))
262 if (TREE_CODE (t1
) != TREE_CODE (t2
))
263 return return_false ();
265 switch (TREE_CODE (t1
))
268 /* All function decls are in the symbol table and known to match
269 before we start comparing bodies. */
272 return return_with_debug (compare_variable_decl (t1
, t2
));
275 int *bb1
= m_label_bb_map
.get (t1
);
276 int *bb2
= m_label_bb_map
.get (t2
);
277 /* Labels can point to another function (non-local GOTOs). */
278 return return_with_debug (bb1
!= NULL
&& bb2
!= NULL
&& *bb1
== *bb2
);
284 return compare_decl (t1
, t2
);
286 return compare_ssa_name (t1
, t2
);
291 return operand_compare::operand_equal_p (t1
, t2
, flags
);
294 /* Function responsible for comparison of various operands T1 and T2.
295 If these components, from functions FUNC1 and FUNC2, are equal, true
299 func_checker::compare_operand (tree t1
, tree t2
)
305 if (operand_equal_p (t1
, t2
, OEP_MATCH_SIDE_EFFECTS
))
307 return return_false_with_msg ("operand_equal_p failed");
311 func_checker::compare_asm_inputs_outputs (tree t1
, tree t2
)
313 gcc_assert (TREE_CODE (t1
) == TREE_LIST
);
314 gcc_assert (TREE_CODE (t2
) == TREE_LIST
);
316 for (; t1
; t1
= TREE_CHAIN (t1
))
321 if (!compare_operand (TREE_VALUE (t1
), TREE_VALUE (t2
)))
322 return return_false ();
324 tree p1
= TREE_PURPOSE (t1
);
325 tree p2
= TREE_PURPOSE (t2
);
327 gcc_assert (TREE_CODE (p1
) == TREE_LIST
);
328 gcc_assert (TREE_CODE (p2
) == TREE_LIST
);
330 if (strcmp (TREE_STRING_POINTER (TREE_VALUE (p1
)),
331 TREE_STRING_POINTER (TREE_VALUE (p2
))) != 0)
332 return return_false ();
334 t2
= TREE_CHAIN (t2
);
338 return return_false ();
343 /* Verifies that trees T1 and T2 do correspond. */
346 func_checker::compare_variable_decl (const_tree t1
, const_tree t2
)
353 if (DECL_ALIGN (t1
) != DECL_ALIGN (t2
))
354 return return_false_with_msg ("alignments are different");
356 if (DECL_HARD_REGISTER (t1
) != DECL_HARD_REGISTER (t2
))
357 return return_false_with_msg ("DECL_HARD_REGISTER are different");
359 if (DECL_HARD_REGISTER (t1
)
360 && DECL_ASSEMBLER_NAME_RAW (t1
) != DECL_ASSEMBLER_NAME_RAW (t2
))
361 return return_false_with_msg ("HARD REGISTERS are different");
363 /* Symbol table variables are known to match before we start comparing
365 if (decl_in_symtab_p (t1
))
366 return decl_in_symtab_p (t2
);
367 ret
= compare_decl (t1
, t2
);
369 return return_with_debug (ret
);
372 /* Compare loop information for basic blocks BB1 and BB2. */
375 func_checker::compare_loops (basic_block bb1
, basic_block bb2
)
377 if ((bb1
->loop_father
== NULL
) != (bb2
->loop_father
== NULL
))
378 return return_false ();
380 class loop
*l1
= bb1
->loop_father
;
381 class loop
*l2
= bb2
->loop_father
;
385 if ((bb1
== l1
->header
) != (bb2
== l2
->header
))
386 return return_false_with_msg ("header");
387 if ((bb1
== l1
->latch
) != (bb2
== l2
->latch
))
388 return return_false_with_msg ("latch");
389 if (l1
->simdlen
!= l2
->simdlen
)
390 return return_false_with_msg ("simdlen");
391 if (l1
->safelen
!= l2
->safelen
)
392 return return_false_with_msg ("safelen");
393 if (l1
->can_be_parallel
!= l2
->can_be_parallel
)
394 return return_false_with_msg ("can_be_parallel");
395 if (l1
->dont_vectorize
!= l2
->dont_vectorize
)
396 return return_false_with_msg ("dont_vectorize");
397 if (l1
->force_vectorize
!= l2
->force_vectorize
)
398 return return_false_with_msg ("force_vectorize");
399 if (l1
->finite_p
!= l2
->finite_p
)
400 return return_false_with_msg ("finite_p");
401 if (l1
->unroll
!= l2
->unroll
)
402 return return_false_with_msg ("unroll");
403 if (!compare_variable_decl (l1
->simduid
, l2
->simduid
))
404 return return_false_with_msg ("simduid");
409 /* Function visits all gimple labels and creates corresponding
410 mapping between basic blocks and labels. */
413 func_checker::parse_labels (sem_bb
*bb
)
415 for (gimple_stmt_iterator gsi
= gsi_start_bb (bb
->bb
); !gsi_end_p (gsi
);
418 gimple
*stmt
= gsi_stmt (gsi
);
420 if (glabel
*label_stmt
= dyn_cast
<glabel
*> (stmt
))
422 const_tree t
= gimple_label_label (label_stmt
);
423 gcc_assert (TREE_CODE (t
) == LABEL_DECL
);
425 m_label_bb_map
.put (t
, bb
->bb
->index
);
430 /* Basic block equivalence comparison function that returns true if
431 basic blocks BB1 and BB2 (from functions FUNC1 and FUNC2) correspond.
433 In general, a collection of equivalence dictionaries is built for types
434 like SSA names, declarations (VAR_DECL, PARM_DECL, ..). This infrastructure
435 is utilized by every statement-by-statement comparison function. */
438 func_checker::compare_bb (sem_bb
*bb1
, sem_bb
*bb2
)
440 gimple_stmt_iterator gsi1
, gsi2
;
443 gsi1
= gsi_start_nondebug_bb (bb1
->bb
);
444 gsi2
= gsi_start_nondebug_bb (bb2
->bb
);
446 while (!gsi_end_p (gsi1
))
448 if (gsi_end_p (gsi2
))
449 return return_false ();
451 s1
= gsi_stmt (gsi1
);
452 s2
= gsi_stmt (gsi2
);
454 int eh1
= lookup_stmt_eh_lp_fn
455 (DECL_STRUCT_FUNCTION (m_source_func_decl
), s1
);
456 int eh2
= lookup_stmt_eh_lp_fn
457 (DECL_STRUCT_FUNCTION (m_target_func_decl
), s2
);
460 return return_false_with_msg ("EH regions are different");
462 if (gimple_code (s1
) != gimple_code (s2
))
463 return return_false_with_msg ("gimple codes are different");
465 switch (gimple_code (s1
))
468 if (!compare_gimple_call (as_a
<gcall
*> (s1
),
469 as_a
<gcall
*> (s2
)))
470 return return_different_stmts (s1
, s2
, "GIMPLE_CALL");
473 if (!compare_gimple_assign (s1
, s2
))
474 return return_different_stmts (s1
, s2
, "GIMPLE_ASSIGN");
477 if (!compare_gimple_cond (s1
, s2
))
478 return return_different_stmts (s1
, s2
, "GIMPLE_COND");
481 if (!compare_gimple_switch (as_a
<gswitch
*> (s1
),
482 as_a
<gswitch
*> (s2
)))
483 return return_different_stmts (s1
, s2
, "GIMPLE_SWITCH");
487 case GIMPLE_EH_DISPATCH
:
488 if (gimple_eh_dispatch_region (as_a
<geh_dispatch
*> (s1
))
489 != gimple_eh_dispatch_region (as_a
<geh_dispatch
*> (s2
)))
490 return return_different_stmts (s1
, s2
, "GIMPLE_EH_DISPATCH");
493 if (!compare_gimple_resx (as_a
<gresx
*> (s1
),
494 as_a
<gresx
*> (s2
)))
495 return return_different_stmts (s1
, s2
, "GIMPLE_RESX");
498 if (!compare_gimple_label (as_a
<glabel
*> (s1
),
499 as_a
<glabel
*> (s2
)))
500 return return_different_stmts (s1
, s2
, "GIMPLE_LABEL");
503 if (!compare_gimple_return (as_a
<greturn
*> (s1
),
504 as_a
<greturn
*> (s2
)))
505 return return_different_stmts (s1
, s2
, "GIMPLE_RETURN");
508 if (!compare_gimple_goto (s1
, s2
))
509 return return_different_stmts (s1
, s2
, "GIMPLE_GOTO");
512 if (!compare_gimple_asm (as_a
<gasm
*> (s1
),
514 return return_different_stmts (s1
, s2
, "GIMPLE_ASM");
520 return return_false_with_msg ("Unknown GIMPLE code reached");
523 gsi_next_nondebug (&gsi1
);
524 gsi_next_nondebug (&gsi2
);
527 if (!gsi_end_p (gsi2
))
528 return return_false ();
530 if (!compare_loops (bb1
->bb
, bb2
->bb
))
531 return return_false ();
536 /* Verifies for given GIMPLEs S1 and S2 that
537 call statements are semantically equivalent. */
540 func_checker::compare_gimple_call (gcall
*s1
, gcall
*s2
)
545 if (gimple_call_num_args (s1
) != gimple_call_num_args (s2
))
548 t1
= gimple_call_fn (s1
);
549 t2
= gimple_call_fn (s2
);
550 if (!compare_operand (t1
, t2
))
551 return return_false ();
554 if (gimple_call_internal_p (s1
) != gimple_call_internal_p (s2
)
555 || gimple_call_ctrl_altering_p (s1
) != gimple_call_ctrl_altering_p (s2
)
556 || gimple_call_tail_p (s1
) != gimple_call_tail_p (s2
)
557 || gimple_call_return_slot_opt_p (s1
) != gimple_call_return_slot_opt_p (s2
)
558 || gimple_call_from_thunk_p (s1
) != gimple_call_from_thunk_p (s2
)
559 || gimple_call_va_arg_pack_p (s1
) != gimple_call_va_arg_pack_p (s2
)
560 || gimple_call_alloca_for_var_p (s1
) != gimple_call_alloca_for_var_p (s2
))
563 if (gimple_call_internal_p (s1
)
564 && gimple_call_internal_fn (s1
) != gimple_call_internal_fn (s2
))
567 tree fntype1
= gimple_call_fntype (s1
);
568 tree fntype2
= gimple_call_fntype (s2
);
569 if ((fntype1
&& !fntype2
)
570 || (!fntype1
&& fntype2
)
571 || (fntype1
&& !types_compatible_p (fntype1
, fntype2
)))
572 return return_false_with_msg ("call function types are not compatible");
574 if (fntype1
&& fntype2
&& comp_type_attributes (fntype1
, fntype2
) != 1)
575 return return_false_with_msg ("different fntype attributes");
577 tree chain1
= gimple_call_chain (s1
);
578 tree chain2
= gimple_call_chain (s2
);
579 if ((chain1
&& !chain2
)
580 || (!chain1
&& chain2
)
581 || !compare_operand (chain1
, chain2
))
582 return return_false_with_msg ("static call chains are different");
584 /* Checking of argument. */
585 for (i
= 0; i
< gimple_call_num_args (s1
); ++i
)
587 t1
= gimple_call_arg (s1
, i
);
588 t2
= gimple_call_arg (s2
, i
);
590 if (!compare_operand (t1
, t2
))
591 return return_false_with_msg ("GIMPLE call operands are different");
594 /* Return value checking. */
595 t1
= gimple_get_lhs (s1
);
596 t2
= gimple_get_lhs (s2
);
598 return compare_operand (t1
, t2
);
602 /* Verifies for given GIMPLEs S1 and S2 that
603 assignment statements are semantically equivalent. */
606 func_checker::compare_gimple_assign (gimple
*s1
, gimple
*s2
)
609 tree_code code1
, code2
;
612 code1
= gimple_expr_code (s1
);
613 code2
= gimple_expr_code (s2
);
618 code1
= gimple_assign_rhs_code (s1
);
619 code2
= gimple_assign_rhs_code (s2
);
624 for (i
= 0; i
< gimple_num_ops (s1
); i
++)
626 arg1
= gimple_op (s1
, i
);
627 arg2
= gimple_op (s2
, i
);
629 /* Compare types for LHS. */
632 if (!compatible_types_p (TREE_TYPE (arg1
), TREE_TYPE (arg2
)))
633 return return_false_with_msg ("GIMPLE NOP LHS type mismatch");
636 if (!compare_operand (arg1
, arg2
))
637 return return_false_with_msg ("GIMPLE assignment operands "
645 /* Verifies for given GIMPLEs S1 and S2 that
646 condition statements are semantically equivalent. */
649 func_checker::compare_gimple_cond (gimple
*s1
, gimple
*s2
)
652 tree_code code1
, code2
;
654 code1
= gimple_expr_code (s1
);
655 code2
= gimple_expr_code (s2
);
660 t1
= gimple_cond_lhs (s1
);
661 t2
= gimple_cond_lhs (s2
);
663 if (!compare_operand (t1
, t2
))
666 t1
= gimple_cond_rhs (s1
);
667 t2
= gimple_cond_rhs (s2
);
669 return compare_operand (t1
, t2
);
672 /* Verifies for given GIMPLE_LABEL stmts S1 and S2 that
673 label statements are semantically equivalent. */
676 func_checker::compare_gimple_label (const glabel
*g1
, const glabel
*g2
)
681 tree t1
= gimple_label_label (g1
);
682 tree t2
= gimple_label_label (g2
);
684 if (FORCED_LABEL (t1
) || FORCED_LABEL (t2
))
685 return return_false_with_msg ("FORCED_LABEL");
687 /* As the pass build BB to label mapping, no further check is needed. */
691 /* Verifies for given GIMPLE_SWITCH stmts S1 and S2 that
692 switch statements are semantically equivalent. */
695 func_checker::compare_gimple_switch (const gswitch
*g1
, const gswitch
*g2
)
697 unsigned lsize1
, lsize2
, i
;
699 lsize1
= gimple_switch_num_labels (g1
);
700 lsize2
= gimple_switch_num_labels (g2
);
702 if (lsize1
!= lsize2
)
705 tree t1
= gimple_switch_index (g1
);
706 tree t2
= gimple_switch_index (g2
);
708 if (!compare_operand (t1
, t2
))
711 for (i
= 0; i
< lsize1
; i
++)
713 tree label1
= gimple_switch_label (g1
, i
);
714 tree label2
= gimple_switch_label (g2
, i
);
716 /* Label LOW and HIGH comparison. */
717 tree low1
= CASE_LOW (label1
);
718 tree low2
= CASE_LOW (label2
);
720 if (!tree_int_cst_equal (low1
, low2
))
721 return return_false_with_msg ("case low values are different");
723 tree high1
= CASE_HIGH (label1
);
724 tree high2
= CASE_HIGH (label2
);
726 if (!tree_int_cst_equal (high1
, high2
))
727 return return_false_with_msg ("case high values are different");
729 if (TREE_CODE (label1
) == CASE_LABEL_EXPR
730 && TREE_CODE (label2
) == CASE_LABEL_EXPR
)
732 label1
= CASE_LABEL (label1
);
733 label2
= CASE_LABEL (label2
);
735 if (!compare_operand (label1
, label2
))
736 return return_false_with_msg ("switch label_exprs are different");
738 else if (!tree_int_cst_equal (label1
, label2
))
739 return return_false_with_msg ("switch labels are different");
745 /* Verifies for given GIMPLE_RETURN stmts S1 and S2 that
746 return statements are semantically equivalent. */
749 func_checker::compare_gimple_return (const greturn
*g1
, const greturn
*g2
)
753 t1
= gimple_return_retval (g1
);
754 t2
= gimple_return_retval (g2
);
756 /* Void return type. */
757 if (t1
== NULL
&& t2
== NULL
)
760 return compare_operand (t1
, t2
);
763 /* Verifies for given GIMPLEs S1 and S2 that
764 goto statements are semantically equivalent. */
767 func_checker::compare_gimple_goto (gimple
*g1
, gimple
*g2
)
771 dest1
= gimple_goto_dest (g1
);
772 dest2
= gimple_goto_dest (g2
);
774 if (TREE_CODE (dest1
) != TREE_CODE (dest2
) || TREE_CODE (dest1
) != SSA_NAME
)
777 return compare_operand (dest1
, dest2
);
780 /* Verifies for given GIMPLE_RESX stmts S1 and S2 that
781 resx statements are semantically equivalent. */
784 func_checker::compare_gimple_resx (const gresx
*g1
, const gresx
*g2
)
786 return gimple_resx_region (g1
) == gimple_resx_region (g2
);
789 /* Verifies for given GIMPLEs S1 and S2 that ASM statements are equivalent.
790 For the beginning, the pass only supports equality for
791 '__asm__ __volatile__ ("", "", "", "memory")'. */
794 func_checker::compare_gimple_asm (const gasm
*g1
, const gasm
*g2
)
796 if (gimple_asm_volatile_p (g1
) != gimple_asm_volatile_p (g2
))
799 if (gimple_asm_input_p (g1
) != gimple_asm_input_p (g2
))
802 if (gimple_asm_inline_p (g1
) != gimple_asm_inline_p (g2
))
805 if (gimple_asm_ninputs (g1
) != gimple_asm_ninputs (g2
))
808 if (gimple_asm_noutputs (g1
) != gimple_asm_noutputs (g2
))
811 /* We do not suppport goto ASM statement comparison. */
812 if (gimple_asm_nlabels (g1
) || gimple_asm_nlabels (g2
))
815 if (gimple_asm_nclobbers (g1
) != gimple_asm_nclobbers (g2
))
818 if (strcmp (gimple_asm_string (g1
), gimple_asm_string (g2
)) != 0)
819 return return_false_with_msg ("ASM strings are different");
821 for (unsigned i
= 0; i
< gimple_asm_ninputs (g1
); i
++)
823 tree input1
= gimple_asm_input_op (g1
, i
);
824 tree input2
= gimple_asm_input_op (g2
, i
);
826 if (!compare_asm_inputs_outputs (input1
, input2
))
827 return return_false_with_msg ("ASM input is different");
830 for (unsigned i
= 0; i
< gimple_asm_noutputs (g1
); i
++)
832 tree output1
= gimple_asm_output_op (g1
, i
);
833 tree output2
= gimple_asm_output_op (g2
, i
);
835 if (!compare_asm_inputs_outputs (output1
, output2
))
836 return return_false_with_msg ("ASM output is different");
839 for (unsigned i
= 0; i
< gimple_asm_nclobbers (g1
); i
++)
841 tree clobber1
= gimple_asm_clobber_op (g1
, i
);
842 tree clobber2
= gimple_asm_clobber_op (g2
, i
);
844 if (!operand_equal_p (TREE_VALUE (clobber1
), TREE_VALUE (clobber2
),
846 return return_false_with_msg ("ASM clobber is different");
852 } // ipa_icf_gimple namespace