comparison gcc/tree-ssa-loop-unswitch.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
1 /* Loop unswitching. 1 /* Loop unswitching.
2 Copyright (C) 2004-2017 Free Software Foundation, Inc. 2 Copyright (C) 2004-2018 Free Software Foundation, Inc.
3 3
4 This file is part of GCC. 4 This file is part of GCC.
5 5
6 GCC is free software; you can redistribute it and/or modify it 6 GCC is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the 7 under the terms of the GNU General Public License as published by the
850 new_edge = make_edge (pre_header, exit->dest, flags); 850 new_edge = make_edge (pre_header, exit->dest, flags);
851 851
852 /* Determine the probability that we skip the loop. Assume that loop has 852 /* Determine the probability that we skip the loop. Assume that loop has
853 same average number of iterations regardless outcome of guard. */ 853 same average number of iterations regardless outcome of guard. */
854 new_edge->probability = guard->probability; 854 new_edge->probability = guard->probability;
855 profile_count skip_count = guard->src->count > 0 855 profile_count skip_count = guard->src->count.nonzero_p ()
856 ? guard->count ().apply_scale (pre_header->count, 856 ? guard->count ().apply_scale (pre_header->count,
857 guard->src->count) 857 guard->src->count)
858 : guard->count ().apply_probability (new_edge->probability); 858 : guard->count ().apply_probability (new_edge->probability);
859 859
860 if (skip_count > e->count ()) 860 if (skip_count > e->count ())
873 873
874 First decrease count of path from newly hoisted loop guard 874 First decrease count of path from newly hoisted loop guard
875 to loop header... */ 875 to loop header... */
876 e->probability = new_edge->probability.invert (); 876 e->probability = new_edge->probability.invert ();
877 e->dest->count = e->count (); 877 e->dest->count = e->count ();
878 e->dest->frequency = EDGE_FREQUENCY (e);
879 878
880 /* ... now update profile to represent that original guard will be optimized 879 /* ... now update profile to represent that original guard will be optimized
881 away ... */ 880 away ... */
882 guard->probability = profile_probability::never (); 881 guard->probability = profile_probability::never ();
883 not_guard->probability = profile_probability::always (); 882 not_guard->probability = profile_probability::always ();