From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 774 invoked by alias); 16 Jul 2011 04:31:51 -0000 Received: (qmail 762 invoked by uid 22791); 16 Jul 2011 04:31:50 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_CF,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-yx0-f175.google.com (HELO mail-yx0-f175.google.com) (209.85.213.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 16 Jul 2011 04:31:36 +0000 Received: by yxi19 with SMTP id 19so878331yxi.20 for ; Fri, 15 Jul 2011 21:31:36 -0700 (PDT) Received: by 10.90.249.13 with SMTP id w13mr4087446agh.122.1310790695883; Fri, 15 Jul 2011 21:31:35 -0700 (PDT) Received: from excelsa.csse.unimelb.edu.au (davis-asusnb-plugin.csse.unimelb.edu.au [128.250.29.188]) by mx.google.com with ESMTPS id t13sm1957268anh.11.2011.07.15.21.31.33 (version=SSLv3 cipher=OTHER); Fri, 15 Jul 2011 21:31:35 -0700 (PDT) Date: Sat, 16 Jul 2011 06:53:00 -0000 From: Matt Davis To: gcc@gcc.gnu.org Subject: Updating the CFG after function modifcation Message-ID: <20110716043126.GA8647@excelsa.csse.unimelb.edu.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2011-07/txt/msg00262.txt.bz2 Hello, I have an IPA pass (implemented as a plugin) which executes after all IPA passes. My pass transforms functions by adding code and also modifying the function prototypes. I have had this work on a per-function basis, via a GIMPLE_PASS, which calls update_ssa verify_ssa and cleanup_cfg after each function is processed. However, I have recently moved my plugin to execute after all IPA passes, so I can iterate over the cfg of the program. The first iteration is an analysis, and the second iteration does the transformations. Unfortunately, I keep getting errors now, primarily a segfault in "compute_call_stmt_bb_frequency" in the processing of the main(). The segfault occurs because the argument 'bb' is NULL and later dereferenced. (NOTE: I do not modify the prototype of main). The e->call_stmt that the null basic block references is from a statement I have removed via gsi_remove during my transformation pass. I need to clean up the cfg somehow, after I remove the statement. My gimple pass, with this same functionality worked fine. Something tells me that my plugin should be in a different position. I also tried calling cleanup_tree_cfg() after my transformation pass, still no luck Any suggestions would be welcomed. Thanks for even reading this far. -Matt