{"id":816175,"url":"http://patchwork.ozlabs.org/api/1.2/patches/816175/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/87lgl91sd0.fsf@linaro.org/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.2/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<87lgl91sd0.fsf@linaro.org>","list_archive_url":null,"date":"2017-09-20T12:12:27","name":"Tighten tree-ssa-ccp.c:get_value_for_expr condition","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"13748f8dcd5a7f91599183e0252d014ea3094abe","submitter":{"id":5450,"url":"http://patchwork.ozlabs.org/api/1.2/people/5450/?format=json","name":"Richard Sandiford","email":"richard.sandiford@linaro.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/87lgl91sd0.fsf@linaro.org/mbox/","series":[{"id":4097,"url":"http://patchwork.ozlabs.org/api/1.2/series/4097/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=4097","date":"2017-09-20T12:12:27","name":"Tighten tree-ssa-ccp.c:get_value_for_expr condition","version":1,"mbox":"http://patchwork.ozlabs.org/series/4097/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/816175/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/816175/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-return-462578-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-462578-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"Zz0EehnI\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xxzCJ367bz9t2Q\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 20 Sep 2017 22:12:43 +1000 (AEST)","(qmail 49437 invoked by alias); 20 Sep 2017 12:12:34 -0000","(qmail 49425 invoked by uid 89); 20 Sep 2017 12:12:33 -0000","from mail-wm0-f42.google.com (HELO mail-wm0-f42.google.com)\n\t(74.125.82.42) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tWed, 20 Sep 2017 12:12:32 +0000","by mail-wm0-f42.google.com with SMTP id g206so6619789wme.0 for\n\t<gcc-patches@gcc.gnu.org>; Wed, 20 Sep 2017 05:12:32 -0700 (PDT)","from localhost (92.40.248.127.threembb.co.uk. [92.40.248.127]) by\n\tsmtp.gmail.com with ESMTPSA id\n\ty84sm1466545wmg.43.2017.09.20.05.12.28 for\n\t<gcc-patches@gcc.gnu.org> (version=TLS1_2\n\tcipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tWed, 20 Sep 2017 05:12:29 -0700 (PDT)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:from\n\t:to:subject:date:message-id:mime-version:content-type; q=dns; s=\n\tdefault; b=gjhROOOVhSixS2sGRNExSacg/pWRfQ6delQVEsfio+1QO16A8oUWi\n\tGjxwNxdmR1k5lChmYuM4XGHv2fibg6FcSAtSK4Q3eIsycGIPl40M2rmjFXGwmfV7\n\tkCfkW6D0C7EnNOboTR7bfEkzMZ81H5Z97aoGH5MoEiszKhFnGYyqNo=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:from\n\t:to:subject:date:message-id:mime-version:content-type; s=\n\tdefault; bh=U8VGlh//Let1BxpA1SPghIJ7ImQ=; b=Zz0EehnIhwODoYevLk/T\n\tNtl1h89t3feh9zmW1Z2OiwNdmZFtb4QFt5HgWMxZMJorQFPKEn+JMoEj7cCgXTAj\n\t6z1lx24gkIgZaMtOiw7B+pZsbJeH9GCa6oQ+LUC5oYBR84UiM9EjstdbENrNN+uE\n\tnp3Rf/99XfYyhwhCGMRd7cw=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-11.3 required=5.0 tests=AWL, BAYES_00,\n\tGIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_SORBS_SPAM,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=(unknown)","X-HELO":"mail-wm0-f42.google.com","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net;\n\ts=20161025;\n\th=x-gm-message-state:from:to:mail-followup-to:subject:date:message-id\n\t:user-agent:mime-version;\n\tbh=8AqXixXmjdlUNermQpYMsencmfeajT/M7A7CDBBSENk=;\n\tb=TOiKTB2J+gMB5BtHP1FNVUE8oLjBKn9tTQJ7AljdipyWOx8j1ii15yG4HRZwThB4FN\n\tJyqv4pTb5tbzakZm+Y6OMqZDv5ffZICjxSjc4VD8E1w+2hM1D2gzGPyrkhRu19/pzwmA\n\tyHKwL0ACHL9yvAy7JxeVza+e6hkCA6uOEcWeOCwuASZXcUtLgrtYOFfK5qKq4Z0LIv2g\n\tg7vk2KKd0KrBE4GD5MNMzzo7G0iXXug+XiR3kZ28QFXaLKuDbsaRX4Nux/O2fNF+sutZ\n\tD5y+NtE/xLM+lIJnQqlGSKrituKYl95krfyQhJtrjX751TQqPTtfoeIs0q+K36yRNTP1\n\tz4rQ==","X-Gm-Message-State":"AHPjjUg0SP9knPLPcjpo8XMOBlXkPUAPUMH8+7Ap4B2tl/ZciF74Z/5f\tplWNl/FnwIO4tNQkIfiD1as56R1H5lY=","X-Google-Smtp-Source":"AOwi7QB3OoMcmp0QRWlKA58LXZpa1ljaYa2SO5Wbmx8G8gzeW2i+YpNvPHfidKjc9EfleKC26qY03w==","X-Received":"by 10.28.158.208 with SMTP id h199mr3609411wme.47.1505909550311;\n\tWed, 20 Sep 2017 05:12:30 -0700 (PDT)","From":"Richard Sandiford <richard.sandiford@linaro.org>","To":"gcc-patches@gcc.gnu.org","Mail-Followup-To":"gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org","Subject":"Tighten tree-ssa-ccp.c:get_value_for_expr condition","Date":"Wed, 20 Sep 2017 13:12:27 +0100","Message-ID":"<87lgl91sd0.fsf@linaro.org>","User-Agent":"Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)","MIME-Version":"1.0","Content-Type":"text/plain"},"content":"bit_value_unop and bit_value_binop require constant values\nto be INTEGER_CSTs:\n\n  gcc_assert ((rval.lattice_val == CONSTANT\n               && TREE_CODE (rval.value) == INTEGER_CST)\n              || wi::sext (rval.mask, TYPE_PRECISION (TREE_TYPE (rhs))) == -1);\n\nHowever, when deciding whether to record a constant value,\nthe for_bits_p handling in get_value_for_expr used a negative\ntest for ADDR_EXPR:\n\n  else if (is_gimple_min_invariant (expr)\n           && (!for_bits_p || TREE_CODE (expr) != ADDR_EXPR))\n\nThis patch uses a positive test for INTEGER_CST instead.\n\nExisting tests showed the need for this once polynomial constants\nare added.\n\nTested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linus-gnu.\nOK to install?\n\nRichard\n\n\n2017-09-20  Richard Sandiford  <richard.sandiford@linaro.org>\n\t    Alan Hayward  <alan.hayward@arm.com>\n\t    David Sherwood  <david.sherwood@arm.com>\n\ngcc/\n\t* tree-ssa-ccp.c (get_value_for_expr): Use a positive test for\n\tINTEGER_CST rather than a negative test for ADDR_EXPR.","diff":"Index: gcc/tree-ssa-ccp.c\n===================================================================\n--- gcc/tree-ssa-ccp.c\t2017-08-10 14:36:07.842479033 +0100\n+++ gcc/tree-ssa-ccp.c\t2017-09-20 13:10:31.466004578 +0100\n@@ -617,7 +617,7 @@ get_value_for_expr (tree expr, bool for_\n \t}\n     }\n   else if (is_gimple_min_invariant (expr)\n-\t   && (!for_bits_p || TREE_CODE (expr) != ADDR_EXPR))\n+\t   && (!for_bits_p || TREE_CODE (expr) == INTEGER_CST))\n     {\n       val.lattice_val = CONSTANT;\n       val.value = expr;\n","prefixes":[]}