From patchwork Sat Nov 14 07:11:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Senthil Kumar Selvaraj X-Patchwork-Id: 544739 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 53D38140D24 for ; Sat, 14 Nov 2015 18:12:30 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=IiJgjuGm; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=pD97IYyee1OVklObRzFDVXVCTJ9xAfmbZ+hVkrF4T9fNHTXCua riF/onTx+cLG2pTMggRMhSyB7YBs8S+WIq/0V0h6J6boFDyLDMHLcQsacHhZRV8F sTN5K6CQxZrGgnEUx/ZcNIJCAhpcahiOIGiTdTQJgY0xgMJqAVzZpsDRU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=tHc+eNWF6T4D+uYAwCQ7ul20HVk=; b=IiJgjuGmEr5GoyDBPlMQ lLKjZK2J9rkbcvLJf/XXYoqqcRYnjHkLc9PaPwTBo9EQy7y8rFfEVt117ac+gOiE bHS7NPpkoPdecqd/2QMdFWERQK4Su4o7qg5kpJJrhtT0itCPluHN3DprWTRuYk7l ASYwv532LPAdc1xIq9V+7Uw= Received: (qmail 120623 invoked by alias); 14 Nov 2015 07:12:21 -0000 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 Received: (qmail 120606 invoked by uid 89); 14 Nov 2015 07:12:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: eusmtp01.atmel.com Received: from eusmtp01.atmel.com (HELO eusmtp01.atmel.com) (212.144.249.243) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 14 Nov 2015 07:12:19 +0000 Received: from HNOCHT02.corp.atmel.com (10.161.30.162) by eusmtp01.atmel.com (10.161.101.31) with Microsoft SMTP Server (TLS) id 14.3.235.1; Sat, 14 Nov 2015 08:12:07 +0100 Received: from jaguar.atmel.com (10.161.30.18) by HNOCHT02.corp.atmel.com (10.161.30.162) with Microsoft SMTP Server (TLS) id 14.3.235.1; Sat, 14 Nov 2015 08:12:08 +0100 Date: Sat, 14 Nov 2015 12:41:48 +0530 From: Senthil Kumar Selvaraj To: CC: , Subject: [Patch, vrp] Allow VRP type conversion folding only for widenings upto word mode Message-ID: <20151114071148.GA16647@jaguar.atmel.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes This patch came out of a discussion held in the gcc mailing list (https://gcc.gnu.org/ml/gcc/2015-11/msg00067.html). The patch restricts folding of conditional exprs with lhs previously set by a type conversion to occur only if the source of the type conversion's mode is word mode or smaller. Bootstrapped and reg tested on x86_64 (with --enable-languages=c,c++). If ok, could you commit please? I don't have commit access. Regards Senthil gcc/ChangeLog 2015-11-11 Senthil Kumar Selvaraj * tree-vrp.c (simplify_cond_using_ranges): Fold only if innerop's mode is word_mode or smaller. diff --git gcc/tree-vrp.c gcc/tree-vrp.c index e2393e4..c139bc6 100644 --- gcc/tree-vrp.c +++ gcc/tree-vrp.c @@ -9467,6 +9467,8 @@ simplify_cond_using_ranges (gcond *stmt) innerop = gimple_assign_rhs1 (def_stmt); if (TREE_CODE (innerop) == SSA_NAME + && (GET_MODE_SIZE(TYPE_MODE(TREE_TYPE(innerop))) + <= GET_MODE_SIZE(word_mode)) && !POINTER_TYPE_P (TREE_TYPE (innerop))) { value_range *vr = get_value_range (innerop);