From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1666) id 2C6023858D20; Tue, 2 May 2023 13:24:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2C6023858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683033892; bh=foU4wJJhjHnxmtEv8HfCye1ggf643c7kIkjOcvOufnU=; h=From:To:Subject:Date:From; b=qc1sci7VOAEOHlKx2sAAPF7TPa9k23k0RawiQGV/UT+gi0zLM9Dlc0ADe7fIloB+3 o06biG4O8p+ELaDBPRrOM39wgH+TfefY/kt5U2+d3UFqHxq/NB415d3awb0e88BvJ2 VzHLuhzLliJZ9SF6qopofSho+3qRpD+3kYquJE1M= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Richard Biener To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-10681] tree-optimization/108821 - store motion and volatiles X-Act-Checkin: gcc X-Git-Author: Richard Biener X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: d4baf9f030f3b61499f3e83a3f5fc39bc8427cb5 X-Git-Newrev: bd0192968999661d103bb9d974a8ad3be4ef3d9b Message-Id: <20230502132452.2C6023858D20@sourceware.org> Date: Tue, 2 May 2023 13:24:52 +0000 (GMT) List-Id: https://gcc.gnu.org/g:bd0192968999661d103bb9d974a8ad3be4ef3d9b commit r11-10681-gbd0192968999661d103bb9d974a8ad3be4ef3d9b Author: Richard Biener Date: Fri Feb 17 12:36:44 2023 +0100 tree-optimization/108821 - store motion and volatiles The following fixes store motion to not re-issue volatile stores to preserve TBAA behavior since that will result in the number of volatile accesses changing. PR tree-optimization/108821 * tree-ssa-loop-im.c (sm_seq_valid_bb): We can also not move volatile accesses. * gcc.dg/tree-ssa/ssa-lim-24.c: New testcase. (cherry picked from commit 4c4f0f7acd6b96ee744ef598cbea5c7046a33654) Diff: --- gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-24.c | 25 +++++++++++++++++++++++++ gcc/tree-ssa-loop-im.c | 8 ++++++++ 2 files changed, 33 insertions(+) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-24.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-24.c new file mode 100644 index 00000000000..6b463490a91 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-24.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-lim2-details -fdump-tree-optimized" } */ + +extern volatile int *x; +static int gCrc; + +static int __attribute__((noinline)) crc16Add(int crc, int b) +{ + return crc + b; +} + +void f(int data, int dataSz) +{ + int i; + + for(i=0;iref == UNANALYZABLE_MEM_ID) return -1; + /* Stop at memory references which we can't move. */ + else if (TREE_THIS_VOLATILE + (memory_accesses.refs_list[data->ref]->mem.ref)) + { + /* Mark refs_not_in_seq as unsupported. */ + bitmap_ior_into (refs_not_supported, refs_not_in_seq); + return 1; + } /* One of the stores we want to apply SM to and we've not yet seen. */ else if (bitmap_clear_bit (refs_not_in_seq, data->ref)) {