]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/120043 - bogus conditional store elimination
authorRichard Biener <rguenther@suse.de>
Thu, 8 May 2025 08:05:42 +0000 (10:05 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 8 May 2025 10:59:02 +0000 (12:59 +0200)
commit93586e5d51188bf71f4f8fae4ee94ff631740f24
treedc3f4cc92d244dc13afcff68dccf03e25d4651ca
parent66f5f03853035cc917627e7d044bff8ccd9eca3f
tree-optimization/120043 - bogus conditional store elimination

The following fixes conditional store elimination to properly
check for conditional stores to readonly memory which we can
obviously not store to unconditionally.  The tree_could_trap_p
predicate used is only considering rvalues and the chosen
approach mimics that of loop store motion.

PR tree-optimization/120043
* tree-ssa-phiopt.cc (cond_store_replacement): Check
whether the store is to readonly memory.

* gcc.dg/torture/pr120043.c: New testcase.
gcc/testsuite/gcc.dg/torture/pr120043.c [new file with mode: 0644]
gcc/tree-ssa-phiopt.cc