http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49618
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ebotcazou at gcc dot | |gnu.org, jakub at gcc dot | |gnu.org, rsandifo at gcc | |dot gnu.org --- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-07-04 08:10:19 UTC --- I think the problem is either that the MEM has the MEM_NOTRAP_P flag set on it: (mem/f/i:SI (symbol_ref/i:SI ("__dso_handle") <var_decl 0x7ffff13ce320 __dso_handle>) [0 S4 A32]) That makes ifcvt believe it can try to use a conditional move with that as an operand, and as there is no conditional move with MEM operand on this target, it is forced into register first. MEM_NOTRAP_P is set in set_mem_attributes_minus_bitpos: /* Note whether this expression can trap. */ MEM_NOTRAP_P (ref) = !tree_could_trap_p (t); where t is VAR_DECL for __dso_handle with DECL_WEAK. Or the problem might be that noce_try_cmove_arith should be using else if (may_trap_or_fault_p (a) || may_trap_or_fault_p (b)) return FALSE; instead of else if (may_trap_p (a) || may_trap_p (b)) return FALSE; Eric/Richard, what do you think? The comments seem to be fuzzy to me, some comments say that MEM_NOTRAP_P only apply to the position where the MEM is originally used (and in this case the __dso_handle var is read only guarded with if (__dso_handle != NULL), on the other side I wonder if we ever clear MEM_NOTRAP_P on unguarded DECL_WEAK var references.