From patchwork Sat Aug 27 23:39:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamil Dudka X-Patchwork-Id: 1105392 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7RNhoMn024071 for ; Sat, 27 Aug 2011 23:43:50 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751172Ab1H0Xnt (ORCPT ); Sat, 27 Aug 2011 19:43:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36522 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751054Ab1H0Xnt (ORCPT ); Sat, 27 Aug 2011 19:43:49 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p7RNhDjN012448 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 27 Aug 2011 19:43:13 -0400 Received: from vpn1-7-245.ams2.redhat.com (vpn1-7-245.ams2.redhat.com [10.36.7.245]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p7RNhBZv021353; Sat, 27 Aug 2011 19:43:12 -0400 From: Kamil Dudka To: Linus Torvalds Subject: [PATCH] cse: update PHI users when throwing away an instruction Date: Sun, 28 Aug 2011 01:39:58 +0200 User-Agent: KMail/1.9.10 Cc: Jeff Garzik , "Sparse Mailing-list" , Pekka J Enberg References: <4E588EB8.80808@garzik.org> <4E590F22.6030800@garzik.org> In-Reply-To: MIME-Version: 1.0 Message-Id: <201108280139.59217.kdudka@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Sat, 27 Aug 2011 23:43:51 +0000 (UTC) On Saturday 27 August 2011 17:53:23 Linus Torvalds wrote: > phi2/phi3 are both dead, but theor 'phisrc' instructions haven't been > killed. Ugly. The attached patch solves the dangling PHI nodes and does not seem to break anything at first glance. It is probably not the most efficient solution, but it might at least show where to look for the problem. Kamil From 7024fcdfba9fce20569f86e2a279c76cb94cbfd8 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Sun, 28 Aug 2011 01:29:13 +0200 Subject: [PATCH] cse: update PHI users when throwing away an instruction Signed-off-by: Kamil Dudka --- cse.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/cse.c b/cse.c index 2a15745..1b63c0e 100644 --- a/cse.c +++ b/cse.c @@ -250,6 +250,19 @@ static void sort_instruction_list(struct instruction_list **list) static struct instruction * cse_one_instruction(struct instruction *insn, struct instruction *def) { convert_instruction_target(insn, def->target); + + if (insn->opcode == OP_PHI) { + /* Remove the instruction from PHI users */ + pseudo_t phi; + FOR_EACH_PTR(insn->phi_list, phi) { + struct pseudo_user *pu; + FOR_EACH_PTR(phi->users, pu) { + if (pu->insn == insn) + DELETE_CURRENT_PTR(pu); + } END_FOR_EACH_PTR(pu); + } END_FOR_EACH_PTR(phi); + } + insn->opcode = OP_NOP; insn->bb = NULL; repeat_phase |= REPEAT_CSE; -- 1.7.6