https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82060
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- Author: rguenth Date: Fri Dec 15 10:12:08 2017 New Revision: 255682 URL: https://gcc.gnu.org/viewcvs?rev=255682&root=gcc&view=rev Log: 2017-12-15 Richard Biener <rguent...@suse.de> Backport from mainline PR tree-optimization/82060 * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children): Move devirtualization after stmt folding and before EH/AB/noreturn cleanup to get the stmt refs canonicalized. Use a bool instead of gimple_modified_p since that doesn't work for NOPs. Schedule NOPs generated by folding for removal. * g++.dg/torture/pr82060.C: New testcase. Added: branches/gcc-7-branch/gcc/testsuite/g++.dg/torture/pr82060.C Modified: branches/gcc-7-branch/gcc/ChangeLog branches/gcc-7-branch/gcc/testsuite/ChangeLog branches/gcc-7-branch/gcc/tree-ssa-pre.c