https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21182
--- Comment #31 from Richard Biener <rguenth at gcc dot gnu.org> --- -fno-tree-ter improves things quite a bit. With -DNAILED_REGS gimple doesn't do much because we treat registers as memory here. For trunk -O2 has 52 spills -O2 -fno-tree-ter has 35 spills -O2 -fno-tree-ter -fschedule-insns has 74 spills -O2 -fno-tree-ter -fschedule-insns -fsched-pressure has 18 spills -O2 -fschedule-insns -fsched-pressure has 17 spills to me this really hints at out-of-SSA producing a very bad initial schedule, by TER but also likely due to folding & friends doing random stmt placing (it's all a single BB). I think we'd benefit quite a bit with killing TER (doing all interesting bits pre-RTL or via SSA RTL forwprop) and ordering SSA def expansion for optimal register pressure.