tree-optimization/95172 - avoid mixing conditionalized and ordered SM
authorRichard Biener <rguenther@suse.de>
Mon, 18 May 2020 07:17:24 +0000 (09:17 +0200)
committerRichard Biener <rguenther@suse.de>
Mon, 18 May 2020 09:53:10 +0000 (11:53 +0200)
commit52a0f83980082c9995f2d8ec9b88548520fb8a5f
treeb692c135345da7a3eeeea1ac268995d4603d2339
parent03d549090e3551eb3c4a41a5d63a76cff7112c7b
tree-optimization/95172 - avoid mixing conditionalized and ordered SM

The following testcase shows a missed optimization that then leads to
wrong-code when issueing SMed stores on exits.  When we were able to
compute an ordered sequence of stores for an exit we need to emit
that in the correct order and we can emit it disregarding to any
conditional for whether a store actually happened (we know it did).
We can also improve detection as of whether we need conditional
processing at all.  Both parts fix the testcase.

2020-05-18  Richard Biener  <rguenther@suse.de>

PR tree-optimization/95172
* tree-ssa-loop-im.c (execute_sm): Get flag whether we
eventually need the conditional processing.
(execute_sm_exit): When processing an orderd sequence
avoid doing any conditional processing.
(hoist_memory_references): Pass down whether all edges
have ordered processing for a ref to execute_sm.

* gcc.dg/torture/pr95172.c: New testcase.
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr95172.c [new file with mode: 0644]
gcc/tree-ssa-loop-im.c