On Thu, Jun 29, 2017 at 10:12 PM, Andrew Pinski <pins...@gmail.com> wrote: > Hi, > As described in the bug, tree-if-conv is calling update_stmt on an > old stmt which might have been removed from the IR already > (transforming of an assignment to a call in this case). This fixes > the problem by calling update_stmt on the new statement that fold_stmt > might have created. > > OK? Bootstrapped and tested on aarch64-linux-gnu with no regressions.
update_stmt is not necessary when fold_stmt doesn't return true as gsi_insert_before already updates the stmt. Thus ok with moving update_stmt under the conditional. Thanks, Richard. > Thanks, > Andrew Pinski > ChangeLog: > * tree-if-conv.c (predicate_scalar_phi): Update new_stmt if fold_stmt > returned true. > > testsuite/ChangeLog: > * gcc.dg/torture/pr81245.c: New testcase.