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. 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.