From patchwork Tue Jun 25 14:14:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1952122 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=ToNL0OiW; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=RJi+jV9C; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=LSuZMeWu; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=nhmZDhVD; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W7n0F3mJYz20ZS for ; Wed, 26 Jun 2024 00:14:53 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9344C3870896 for ; Tue, 25 Jun 2024 14:14:51 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) by sourceware.org (Postfix) with ESMTPS id 25D36385DDD5 for ; Tue, 25 Jun 2024 14:14:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 25D36385DDD5 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 25D36385DDD5 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719324870; cv=none; b=xjx7fwECq5ZZYB+oLkWbmTyr8/OBfRZA8Z8JR+XxtpdnJfMKTr5sGU58cxk5cT51m1QpvQkQmUC+9QxapcH65Wy5I5H2xUY2z61qPH0RiRrOSYMGILg7DLEmrYNdMa+PlcAXsyA9D/yQInQT/tqrtvZKi4yGLHiEBzYkr5BOOfg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719324870; c=relaxed/simple; bh=4oPHmyUjj1XqAwi0T9DXA2JhnFq5R1ZQ+vpPXEufiSk=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:MIME-Version; b=tkjPM1D21Cp8DdjWGD7vXFul9/aRkljbkdOmCTLesvzgMEf/ivUAGa/xulw3iUrIIv//TNISvVb8aYY30pPQqwt5Yjl/QuS+cuB3hkf3xcePPgneNtQfGzS7wbKx0Y47E0IxkxPQlSjLInMmo9NDQwgJu7eqOh+BxZUIJckvcC4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from murzim.nue2.suse.org (unknown [10.168.4.243]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 4151C219A3 for ; Tue, 25 Jun 2024 14:14:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1719324867; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=73EhyrZl99AHBAf2RHEr/vzb3aYlzULRQS1I5iAJ2M4=; b=ToNL0OiWzPqJ/u89qJ+ykeUuBsm1oxFpgh4zKLT3gc1EPrHkyC+xU46krhtsb8DkXfdlKF aF5MY2I6udw6+gQJIhlZAAfSiZxpyL/B9728obrKNueKsZh207F576v0Tteod+XCgqvCot 7j0fnabPDb2BGDYO81e2GARckmFK/8U= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1719324867; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=73EhyrZl99AHBAf2RHEr/vzb3aYlzULRQS1I5iAJ2M4=; b=RJi+jV9CXzABeyKawYDk9vbtoxGrj0ne7g2x17vPtL0VGc3uSQ289n3gG/n9np2g/jR2JW 6mw6ntcDWuPQMLDA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1719324866; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=73EhyrZl99AHBAf2RHEr/vzb3aYlzULRQS1I5iAJ2M4=; b=LSuZMeWuQlBYGXlXxvQ9eKEHpx63lFHgnIZPn7txfhegZpxaOc3iEe9wbEwvQ45l6FTUlO JfogFqc9wB4cq2808H3XyuAG9VqBBl5kPCA4jKdIpVqCy7QoJnqp3hDNvwMA6LkhrEV/ev K7IuYjjrYQvNz+LbJtqgh52KpXMB8yw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1719324866; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=73EhyrZl99AHBAf2RHEr/vzb3aYlzULRQS1I5iAJ2M4=; b=nhmZDhVDPB0RoD5Q8jWoUtnU080+XeL8cdO18OuP8POKQSnF240xMT8hh4JpNLc+NGJ7zD XRpk0+wZ7Mg5i2DQ== Date: Tue, 25 Jun 2024 16:14:26 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] tree-optimization/115646 - ICE with pow shrink-wrapping from bitfield MIME-Version: 1.0 X-Spam-Score: 2.67 X-Spamd-Result: default: False [2.67 / 50.00]; NEURAL_SPAM_LONG(3.47)[0.992]; BAYES_HAM(-3.00)[100.00%]; MISSING_MID(2.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.993]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_ONE(0.00)[1]; RCVD_COUNT_ZERO(0.00)[0]; ARC_NA(0.00)[]; MISSING_XM_UA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_NONE(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[] X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MISSING_MID, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Message-Id: <20240625141451.9344C3870896@sourceware.org> The following makes analysis and transform agree on constraints. Bootstrap and regtest pending on x86_64-unknown-linux-gnu. PR tree-optimization/115646 * tree-call-cdce.cc (check_pow): Check for bit_sz values as allowed by transform. * gcc.dg/pr115646.c: New testcase. --- gcc/testsuite/gcc.dg/pr115646.c | 13 +++++++++++++ gcc/tree-call-cdce.cc | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr115646.c diff --git a/gcc/testsuite/gcc.dg/pr115646.c b/gcc/testsuite/gcc.dg/pr115646.c new file mode 100644 index 00000000000..247777bc1e4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr115646.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +extern double pow(double x, double y); + +struct S { + unsigned int a : 3, b : 8, c : 21; +}; + +void foo (struct S *p) +{ + pow (p->c, 42); +} diff --git a/gcc/tree-call-cdce.cc b/gcc/tree-call-cdce.cc index 7f67a0b2dc6..befe6acf178 100644 --- a/gcc/tree-call-cdce.cc +++ b/gcc/tree-call-cdce.cc @@ -260,7 +260,7 @@ check_pow (gcall *pow_call) /* If the type of the base is too wide, the resulting shrink wrapping condition will be too conservative. */ - if (bit_sz > MAX_BASE_INT_BIT_SIZE) + if (bit_sz != 8 && bit_sz != 16 && bit_sz != MAX_BASE_INT_BIT_SIZE) return false; return true;