http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57968
Bug ID: 57968 Summary: MODE_EXIT switches inserted too late Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: amylaar at gcc dot gnu.org I see a miscompilation of ___muldi3 for epiphany-elf; the witch to MODE_EXIT is done at the start of the exit block, even though it contains instructions that require a different mode. The return register on the epiphany is not likely spilled, and a large register file gives lots of freedom to do optimizations; when optimizig ___muldi3, at end end the return value is not so much copied as calculated piecemeal. There is some existing code in compute_pre_exit that is supposed to preserve computations that need a non-exit mode, but the way it is placed means it is only active when the immediate result is part of the return register.