https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61572
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Component|rtl-optimization |tree-optimization Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org --- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- That's because of register __typeof__(0) c asm("rdx"); which AFAIK makes 'rdx' "fixed" in the whole function. What changed recently is that we sunk the b = c; assignment right before its use. Not doing that fixes the issue (but I wonder if the use of that asm isn't undefined from the start). Note that we still happily sink stores to hard registers (that probably always reduces hardreg lifetime). Index: tree-ssa-sink.c =================================================================== --- tree-ssa-sink.c (revision 211928) +++ tree-ssa-sink.c (working copy) @@ -374,6 +374,12 @@ statement_sink_location (gimple stmt, ba nearest to commondom. */ if (gimple_vuse (stmt)) { + /* Do not sink loads from hard registers. */ + if (gimple_assign_single_p (stmt) + && TREE_CODE (gimple_assign_rhs1 (stmt)) == VAR_DECL + && DECL_HARD_REGISTER (gimple_assign_rhs1 (stmt))) + return false; + imm_use_iterator imm_iter; use_operand_p use_p; basic_block found = NULL;