diff options
author | Jakub Jelinek <jakub@redhat.com> | 2019-11-21 17:21:46 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2019-11-21 17:21:46 +0000 |
commit | d64aea27b057326fa976272985c1f799be54233f (patch) | |
tree | c37fd1f55fa16391b904bba7cda7d8795cd931c3 | |
parent | 72127fb68710392e66bcee2039edaa085f8c63d5 (diff) |
PR tree-optimization/91355
* tree-ssa-sink.c (select_best_block): Use >= rather than >
for early_bb scaled count with best_bb count comparison.
* g++.dg/torture/pr91355.C: New test.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@278587 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/torture/pr91355.C | 28 | ||||
-rw-r--r-- | gcc/tree-ssa-sink.c | 2 |
4 files changed, 36 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0b3d05c8881..94048e3a741 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2019-11-21 Jakub Jelinek <jakub@redhat.com> + PR tree-optimization/91355 + * tree-ssa-sink.c (select_best_block): Use >= rather than > + for early_bb scaled count with best_bb count comparison. + Backported from mainline 2019-11-20 Jakub Jelinek <jakub@redhat.com> diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 665d42b7374..d50680c8af9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2019-11-21 Jakub Jelinek <jakub@redhat.com> + PR tree-optimization/91355 + * g++.dg/torture/pr91355.C: New test. + Backported from mainline 2019-11-20 Jakub Jelinek <jakub@redhat.com> diff --git a/gcc/testsuite/g++.dg/torture/pr91355.C b/gcc/testsuite/g++.dg/torture/pr91355.C new file mode 100644 index 00000000000..7a385dc5bdd --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr91355.C @@ -0,0 +1,28 @@ +// PR tree-optimization/91355 +// { dg-do run } +// { dg-options "-std=c++14" } + +unsigned int d = 0; + +struct S { + S () { d++; } + S (const S &) { d++; } + ~S () { d--; } +}; + +void +foo (int i) throw (int) // { dg-warning "dynamic exception specifications are deprecated" } +{ + if (i == 0) + throw 3; + S d; + throw 3; +} + +int +main () +{ + try { foo (1); } catch (...) {} + if (d) + __builtin_abort (); +} diff --git a/gcc/tree-ssa-sink.c b/gcc/tree-ssa-sink.c index 345ed2b0329..5ac18289d90 100644 --- a/gcc/tree-ssa-sink.c +++ b/gcc/tree-ssa-sink.c @@ -229,7 +229,7 @@ select_best_block (basic_block early_bb, /* If result of comparsion is unknown, preffer EARLY_BB. Thus use !(...>=..) rather than (...<...) */ && !(best_bb->count.apply_scale (100, 1) - > (early_bb->count.apply_scale (threshold, 1)))) + >= early_bb->count.apply_scale (threshold, 1))) return best_bb; /* No better block found, so return EARLY_BB, which happens to be the |