aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-if-conv.cc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2024-05-31 10:14:25 +0200
committerRichard Biener <rguenther@suse.de>2024-05-31 14:12:35 +0200
commit65dbe0ab7cdaf2aa84b09a74e594f0faacf1945c (patch)
treebb1008578ce6915f48c545888d9a0ba4f0862106 /gcc/tree-if-conv.cc
parente0ab5ee9bed5cbad9ae344a23ff0d302b8279d32 (diff)
downloadgcc-65dbe0ab7cdaf2aa84b09a74e594f0faacf1945c.zip
gcc-65dbe0ab7cdaf2aa84b09a74e594f0faacf1945c.tar.gz
gcc-65dbe0ab7cdaf2aa84b09a74e594f0faacf1945c.tar.bz2
tree-optimization/115278 - fix DSE in if-conversion wrt volatiles
The following adds the missing guard for volatile stores to the embedded DSE in the loop if-conversion pass. PR tree-optimization/115278 * tree-if-conv.cc (ifcvt_local_dce): Do not DSE volatile stores. * g++.dg/vect/pr115278.cc: New testcase.
Diffstat (limited to 'gcc/tree-if-conv.cc')
-rw-r--r--gcc/tree-if-conv.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/tree-if-conv.cc b/gcc/tree-if-conv.cc
index 09d99fb..c4c3ed4 100644
--- a/gcc/tree-if-conv.cc
+++ b/gcc/tree-if-conv.cc
@@ -3381,7 +3381,9 @@ ifcvt_local_dce (class loop *loop)
gimple_stmt_iterator gsiprev = gsi;
gsi_prev (&gsiprev);
stmt = gsi_stmt (gsi);
- if (gimple_store_p (stmt) && gimple_vdef (stmt))
+ if (!gimple_has_volatile_ops (stmt)
+ && gimple_store_p (stmt)
+ && gimple_vdef (stmt))
{
tree lhs = gimple_get_lhs (stmt);
ao_ref write;