find_dead_or_set_registers uses mark_set_resources to determine if a register is set, and if it is, it concludes that the register is before that set. A register is also considered set when the set is inside a COND_EXEC, thus delay slot scheduling can clobber values in registers that are supposed to remain untouched when a COND_EXEC is not executed.
I have a patch for this, which changes find_dead_or_set_registers to not call mark_set_resources for COND_EXEC patterns when the purpose is to find registers that are killed. I can't post this patch, or the target port we are using, at the moment since we don't have a copyright assignment on file yet. Another approach would be to change mark_set_resources to take a parameter to tell it if the conservative assumption is that the register is set or if it that the register is not set, and change all callers to provide an appropriate value. -- Summary: resource.c:find_dead_or_set_registers doesn't grok COND_EXEC Product: gcc Version: 4.2.1 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: rtl-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: amylaar at gcc dot gnu dot org GCC target triplet: arc-elf32 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35044