From patchwork Fri May 6 20:53:53 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinliang David Li X-Patchwork-Id: 94436 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 49C0C1007DF for ; Sat, 7 May 2011 06:54:14 +1000 (EST) Received: (qmail 30185 invoked by alias); 6 May 2011 20:54:13 -0000 Received: (qmail 30175 invoked by uid 22791); 6 May 2011 20:54:12 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 06 May 2011 20:53:56 +0000 Received: from kpbe17.cbf.corp.google.com (kpbe17.cbf.corp.google.com [172.25.105.81]) by smtp-out.google.com with ESMTP id p46KrthV030294; Fri, 6 May 2011 13:53:55 -0700 Received: from syzygy.mtv.corp.google.com (syzygy.mtv.corp.google.com [172.18.116.118]) by kpbe17.cbf.corp.google.com with ESMTP id p46Krsco010284; Fri, 6 May 2011 13:53:54 -0700 Received: by syzygy.mtv.corp.google.com (Postfix, from userid 74076) id 90939207F2; Fri, 6 May 2011 13:53:53 -0700 (PDT) To: reply@codereview.appspotmail.com, gcc-patches@gcc.gnu.org Subject: [google] revert 173158 (-fstrict-enum-precisions) (issue4503041) Message-Id: <20110506205353.90939207F2@syzygy.mtv.corp.google.com> Date: Fri, 6 May 2011 13:53:53 -0700 (PDT) From: davidxl@google.com (David Li) X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org The following patch reverted r173158 from google/main -- -fstrict-enums provides a better implementation. The test cases are kept with slight modification. Bootstrap and tested with related test cases. Ok for google/main? 2011-05-06 David Li Revert r173158. --- This patch is available for review at http://codereview.appspot.com/4503041 Index: tree-vrp.c =================================================================== --- tree-vrp.c (revision 173415) +++ tree-vrp.c (working copy) @@ -5553,9 +5553,7 @@ stmt_interesting_for_vrp (gimple stmt) && ((is_gimple_call (stmt) && gimple_call_fndecl (stmt) != NULL_TREE && DECL_IS_BUILTIN (gimple_call_fndecl (stmt))) - || !gimple_vuse (stmt)) - && (flag_strict_enum_precision - || TREE_CODE (TREE_TYPE (lhs)) != ENUMERAL_TYPE)) + || !gimple_vuse (stmt))) return true; } else if (gimple_code (stmt) == GIMPLE_COND Index: doc/invoke.texi =================================================================== --- doc/invoke.texi (revision 173415) +++ doc/invoke.texi (working copy) @@ -395,8 +395,8 @@ Objective-C and Objective-C++ Dialects}. -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol -fsignaling-nans -fsingle-precision-constant -fsplit-ivs-in-unroller @gol -fsplit-wide-types -fstack-protector -fstack-protector-all @gol --fstrict-aliasing -fstrict-overflow -fno-strict-enum-precision -fthread-jumps --ftracer -ftree-bit-ccp @gol +-fstrict-aliasing -fstrict-overflow -fthread-jumps -ftracer @gol +-ftree-bit-ccp @gol -ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-copy-prop @gol -ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse @gol -ftree-forwprop -ftree-fre -ftree-loop-if-convert @gol @@ -2075,11 +2075,6 @@ represented in the minimum number of bit enumerators). This assumption may not be valid if the program uses a cast to convert an arbitrary integer value to the enumeration type. -@item -fno-strict-enum-precision -@opindex fno-strict-enum-precision -Do not perform optimizations of switch() statements based on the -precision of enum types. - @item -ftemplate-depth=@var{n} @opindex ftemplate-depth Set the maximum instantiation depth for template classes to @var{n}. Index: testsuite/g++.dg/other/no-strict-enum-precision-3.C =================================================================== --- testsuite/g++.dg/other/no-strict-enum-precision-3.C (revision 173415) +++ testsuite/g++.dg/other/no-strict-enum-precision-3.C (working copy) @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-O2 -fno-strict-enum-precision" } */ +/* { dg-options "-O2 -fno-strict-enums" } */ extern "C" void abort (void); Index: testsuite/g++.dg/other/no-strict-enum-precision-1.C =================================================================== --- testsuite/g++.dg/other/no-strict-enum-precision-1.C (revision 173415) +++ testsuite/g++.dg/other/no-strict-enum-precision-1.C (working copy) @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-fno-strict-enum-precision" } */ +/* { dg-options "-fno-strict-enums" } */ extern "C" void abort (void); Index: testsuite/g++.dg/other/no-strict-enum-precision-2.C =================================================================== --- testsuite/g++.dg/other/no-strict-enum-precision-2.C (revision 173415) +++ testsuite/g++.dg/other/no-strict-enum-precision-2.C (working copy) @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-O2 -fno-strict-enum-precision" } */ +/* { dg-options "-O2 -fno-strict-enums" } */ extern "C" void abort (void); Index: gimplify.c =================================================================== --- gimplify.c (revision 173415) +++ gimplify.c (working copy) @@ -1602,8 +1602,6 @@ gimplify_switch_expr (tree *expr_p, gimp type = TREE_TYPE (SWITCH_COND (switch_expr)); if (len && INTEGRAL_TYPE_P (type) - && (flag_strict_enum_precision - || TREE_CODE (type) != ENUMERAL_TYPE) && TYPE_MIN_VALUE (type) && TYPE_MAX_VALUE (type) && tree_int_cst_equal (CASE_LOW (VEC_index (tree, labels, 0)),