Backported from mainline
2018-01-05 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/83605
* gimple-ssa-strength-reduction.c: Include tree-eh.h.
(find_candidates_dom_walker::before_dom_children): Ignore stmts that
can throw.
* gcc.dg/pr83605.c: New test.
From-SVN: r262052
2018-06-25 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
+ 2018-01-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/83605
+ * gimple-ssa-strength-reduction.c: Include tree-eh.h.
+ (find_candidates_dom_walker::before_dom_children): Ignore stmts that
+ can throw.
+
2017-12-23 Jakub Jelinek <jakub@redhat.com>
PR c++/83553
#include "params.h"
#include "tree-ssa-address.h"
#include "tree-affine.h"
+#include "tree-eh.h"
#include "builtins.h"
\f
/* Information about a strength reduction candidate. Each statement
{
gimple *gs = gsi_stmt (gsi);
+ if (stmt_could_throw_p (gs))
+ continue;
+
if (gimple_vuse (gs) && gimple_assign_single_p (gs))
slsr_process_ref (gs);
2018-06-25 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
+ 2018-01-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/83605
+ * gcc.dg/pr83605.c: New test.
+
2017-12-23 Jakub Jelinek <jakub@redhat.com>
PR c++/83553
--- /dev/null
+/* PR tree-optimization/83605 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -ftrapv -fexceptions -fnon-call-exceptions" } */
+
+int a;
+
+int
+foo (int x)
+{
+ int b = a;
+ {
+ int c;
+ int *d = (x == 0) ? &c : &b;
+
+ for (a = 0; a < 2; ++a)
+ c = (x + b) < a;
+
+ return *d;
+ }
+}