Index: trunk/gcc/config/avr32/avr32.c =================================================================== --- trunk/gcc/config/avr32/avr32.c (revision 42108) +++ trunk/gcc/config/avr32/avr32.c (revision 42335) @@ -3737,7 +3737,34 @@ return 0; } +/* Return TRUE if X contains a MEM expression. */ +int +mem_mentioned_p (rtx x) +{ + const char *fmt; + int i; + if (MEM_P (x)) + return 1; + + fmt = GET_RTX_FORMAT (GET_CODE (x)); + for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--) + { + if (fmt[i] == 'E') + { + int j; + + for (j = XVECLEN (x, i) - 1; j >= 0; j--) + if (mem_mentioned_p (XVECEXP (x, i, j))) + return 1; + } + else if (fmt[i] == 'e' && mem_mentioned_p (XEXP (x, i))) + return 1; + } + + return 0; +} + int avr32_legitimate_pic_operand_p (rtx x) { @@ -7547,7 +7574,7 @@ /* We cannot move memory loads outside of the if-then-else since the memory access should not be perfomed if the condition is not met. */ - && !MEM_P (SET_SRC (op)) ) + && !mem_mentioned_p (SET_SRC (op)) ) { rtx scratch_reg = gen_reg_rtx (mode); rtx op_pattern = copy_rtx (op);