From c9930ecd9c089bc2c9e82136280c9d2f494242bc Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Thu, 20 Jul 2017 07:16:01 +0000 Subject: [PATCH] Fix phi arg location in find_implicit_erroneous_behavior 2017-07-20 Tom de Vries PR tree-optimization/81489 * gimple-ssa-isolate-paths.c (find_implicit_erroneous_behavior): Move read of phi arg location to before loop that modifies phi. From-SVN: r250378 --- gcc/ChangeLog | 6 ++++++ gcc/gimple-ssa-isolate-paths.c | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 499249b7d75..b6750e84013 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-07-20 Tom de Vries + + PR tree-optimization/81489 + * gimple-ssa-isolate-paths.c (find_implicit_erroneous_behavior): Move + read of phi arg location to before loop that modifies phi. + 2017-07-20 Naveen H.S * match.pd (((m1 >/=/<= m2) * d -> (m1 >/=/<= m2) ? d : 0): diff --git a/gcc/gimple-ssa-isolate-paths.c b/gcc/gimple-ssa-isolate-paths.c index 7ad39b4e09b..fbc41057463 100644 --- a/gcc/gimple-ssa-isolate-paths.c +++ b/gcc/gimple-ssa-isolate-paths.c @@ -442,6 +442,8 @@ find_implicit_erroneous_behavior (void) if (!integer_zerop (op)) continue; + location_t phi_arg_loc = gimple_phi_arg_location (phi, i); + /* We've got a NULL PHI argument. Now see if the PHI's result is dereferenced within BB. */ FOR_EACH_IMM_USE_STMT (use_stmt, iter, lhs) @@ -454,7 +456,7 @@ find_implicit_erroneous_behavior (void) location_t loc = gimple_location (use_stmt) ? gimple_location (use_stmt) - : gimple_phi_arg_location (phi, i); + : phi_arg_loc; if (stmt_uses_name_in_undefined_way (use_stmt, lhs, loc)) { -- 2.30.2