From abc0647a4d9f9a7acf0fdf39e9abc2fe39c5948d Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 8 Apr 2016 19:28:20 +0200 Subject: re PR middle-end/70593 (Miscompilation of xen starting with r226901) PR middle-end/70593 * tree-ssa-coalesce.c (build_ssa_conflict_graph): For stmt with multiple SSA_NAME defs, force the outputs other than first to be live before calling live_track_process_def on each output. * gcc.target/i386/pr70593.c: New test. From-SVN: r234834 --- gcc/tree-ssa-coalesce.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'gcc/tree-ssa-coalesce.c') diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c index 93e1e2e..4b0134d 100644 --- a/gcc/tree-ssa-coalesce.c +++ b/gcc/tree-ssa-coalesce.c @@ -906,6 +906,23 @@ build_ssa_conflict_graph (tree_live_info_p liveinfo) else if (is_gimple_debug (stmt)) continue; + /* For stmts with more than one SSA_NAME definition pretend all the + SSA_NAME outputs but the first one are live at this point, so + that conflicts are added in between all those even when they are + actually not really live after the asm, because expansion might + copy those into pseudos after the asm and if multiple outputs + share the same partition, it might overwrite those that should + be live. E.g. + asm volatile (".." : "=r" (a) : "=r" (b) : "0" (a), "1" (a)); + return a; + See PR70593. */ + bool first = true; + FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, SSA_OP_DEF) + if (first) + first = false; + else + live_track_process_use (live, var); + FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, SSA_OP_DEF) live_track_process_def (live, var, graph); -- cgit v1.1