From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 85CA53858C50 for ; Wed, 5 Oct 2022 00:24:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 85CA53858C50 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664929466; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FYMfi7Yhc0pOinkCLnmxUs9PRQqtpbBpvOC3WEORVuc=; b=ekP9jN6o+Pescron8+KINJLL9k1Y7y0RanbZEA4UhLQpUXjHiZqF0xT8WmoLKUnKb0gr8V GIwyjdiqYyDQobaGXVweVbbYAx9em9rcDDXVcUksQWilo0zpK87AHd2qmxB9GdENJyUH1s mjXykcIDkjM6BEw49zGxsjN0jLLq+ag= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-470-3V41C5KaNH-y7RGjVP1MDg-1; Tue, 04 Oct 2022 20:24:25 -0400 X-MC-Unique: 3V41C5KaNH-y7RGjVP1MDg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D7515185A7A8 for ; Wed, 5 Oct 2022 00:24:24 +0000 (UTC) Received: from t14s.localdomain.com (unknown [10.2.17.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id B5AE47AE5; Wed, 5 Oct 2022 00:24:24 +0000 (UTC) From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [committed] analyzer: fold -(-(VAL)) to VAL Date: Tue, 4 Oct 2022 20:24:23 -0400 Message-Id: <20221005002423.710736-1-dmalcolm@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,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 List-Id: Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r13-3075-g7f42f7adfa69fe. gcc/analyzer/ChangeLog: * region-model-manager.cc (region_model_manager::maybe_fold_unaryop): Fold -(-(VAL)) to VAL. Signed-off-by: David Malcolm --- gcc/analyzer/region-model-manager.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gcc/analyzer/region-model-manager.cc b/gcc/analyzer/region-model-manager.cc index ed5b9c75910..1956cfc3e8d 100644 --- a/gcc/analyzer/region-model-manager.cc +++ b/gcc/analyzer/region-model-manager.cc @@ -432,6 +432,17 @@ region_model_manager::maybe_fold_unaryop (tree type, enum tree_code op, } } break; + case NEGATE_EXPR: + { + /* -(-(VAL)) is VAL, for integer types. */ + if (const unaryop_svalue *unaryop = arg->dyn_cast_unaryop_svalue ()) + if (unaryop->get_op () == NEGATE_EXPR + && type == unaryop->get_type () + && type + && INTEGRAL_TYPE_P (type)) + return unaryop->get_arg (); + } + break; } /* Constants. */ -- 2.26.3