ipa-pure-const.c (169690) | ipa-pure-const.c (235623) |
---|---|
1/* Callgraph based analysis of static variables. 2 Copyright (C) 2004, 2005 Free Software Foundation, Inc. 3 Contributed by Kenneth Zadeck <zadeck@naturalbridge.com> 4 5This file is part of GCC. 6 7GCC is free software; you can redistribute it and/or modify it under 8the terms of the GNU General Public License as published by the Free --- 625 unchanged lines hidden (view full) --- 634 635 /* Propagate the local information thru the call graph to produce 636 the global information. All the nodes within a cycle will have 637 the same info so we collapse cycles first. Then we can do the 638 propagation in one pass from the leaves to the roots. */ 639 for (i = 0; i < order_pos; i++ ) 640 { 641 enum pure_const_state_e pure_const_state = IPA_CONST; | 1/* Callgraph based analysis of static variables. 2 Copyright (C) 2004, 2005 Free Software Foundation, Inc. 3 Contributed by Kenneth Zadeck <zadeck@naturalbridge.com> 4 5This file is part of GCC. 6 7GCC is free software; you can redistribute it and/or modify it under 8the terms of the GNU General Public License as published by the Free --- 625 unchanged lines hidden (view full) --- 634 635 /* Propagate the local information thru the call graph to produce 636 the global information. All the nodes within a cycle will have 637 the same info so we collapse cycles first. Then we can do the 638 propagation in one pass from the leaves to the roots. */ 639 for (i = 0; i < order_pos; i++ ) 640 { 641 enum pure_const_state_e pure_const_state = IPA_CONST; |
642 int count = 0; |
|
642 node = order[i]; 643 644 /* Find the worst state for any node in the cycle. */ 645 w = node; 646 while (w) 647 { 648 funct_state w_l = get_function_state (w); 649 if (pure_const_state < w_l->pure_const_state) 650 pure_const_state = w_l->pure_const_state; 651 652 if (pure_const_state == IPA_NEITHER) 653 break; 654 655 if (!w_l->state_set_in_source) 656 { 657 struct cgraph_edge *e; | 643 node = order[i]; 644 645 /* Find the worst state for any node in the cycle. */ 646 w = node; 647 while (w) 648 { 649 funct_state w_l = get_function_state (w); 650 if (pure_const_state < w_l->pure_const_state) 651 pure_const_state = w_l->pure_const_state; 652 653 if (pure_const_state == IPA_NEITHER) 654 break; 655 656 if (!w_l->state_set_in_source) 657 { 658 struct cgraph_edge *e; |
659 count++; 660 661 /* FIXME!!! Because of pr33826, we cannot have either 662 immediate or transitive recursive functions marked as 663 pure or const because dce can delete a function that 664 is in reality an infinite loop. A better solution 665 than just outlawing them is to add another bit the 666 functions to distinguish recursive from non recursive 667 pure and const function. This would allow the 668 recursive ones to be cse'd but not dce'd. In this 669 same vein, we could allow functions with loops to 670 also be cse'd but not dce'd. 671 672 Unfortunately we are late in stage 3, and the fix 673 described above is is not appropriate. */ 674 if (count > 1) 675 { 676 pure_const_state = IPA_NEITHER; 677 break; 678 } 679 |
|
658 for (e = w->callees; e; e = e->next_callee) 659 { 660 struct cgraph_node *y = e->callee; 661 /* Only look at the master nodes and skip external nodes. */ 662 y = cgraph_master_clone (y); | 680 for (e = w->callees; e; e = e->next_callee) 681 { 682 struct cgraph_node *y = e->callee; 683 /* Only look at the master nodes and skip external nodes. */ 684 y = cgraph_master_clone (y); |
685 686 /* Check for immediate recursive functions. See the 687 FIXME above. */ 688 if (w == y) 689 { 690 pure_const_state = IPA_NEITHER; 691 break; 692 } |
|
663 if (y) 664 { 665 funct_state y_l = get_function_state (y); 666 if (pure_const_state < y_l->pure_const_state) 667 pure_const_state = y_l->pure_const_state; 668 if (pure_const_state == IPA_NEITHER) 669 break; 670 } --- 84 unchanged lines hidden --- | 693 if (y) 694 { 695 funct_state y_l = get_function_state (y); 696 if (pure_const_state < y_l->pure_const_state) 697 pure_const_state = y_l->pure_const_state; 698 if (pure_const_state == IPA_NEITHER) 699 break; 700 } --- 84 unchanged lines hidden --- |