Hi, as observed on PR54717 we give up on some partial insertions because of Skipping partial partial redundancy for expression {array_ref<pretmp_8,0,4>,mem_ref<0B>,xxtrt_46(D)}@.MEM_30(D) (0165) not partially anticipated on any to be optimized for speed edges
The logic here is wrong, the edges are tested by optimize_edge_for_speed_p and it never returns false for any edge queried by tree-ssa-pre.c. The problem is that the code looks for basic block BLOCK with partial anticipance of given expression. Then it is trying to check that the path in question is hot by looking for succesors of BLOCK that also do have partial anticipance and are hot. In this testcase BLOCK has two succesors - one without any anticipance and one with full anticipance, so we give up regardless of the profile. This patch fixes it. Unforutnately it seems that the missed vectorization PR is about is not fixed, we give up for alignment issues now. I am looking into this incrementally. Bootstrapped/regtested x86_64-linux, also benchmarkes on spec2k and C++ benchmarks, OK? Honza PR tree-optimization/54717 * tree-ssa-pre.c (do_partial_partial_insertion): Consider also edges with ANTIC_IN. Index: tree-ssa-pre.c =================================================================== *** tree-ssa-pre.c (revision 193503) --- tree-ssa-pre.c (working copy) *************** do_partial_partial_insertion (basic_bloc *** 3525,3531 **** may cause regressions on the speed path. */ FOR_EACH_EDGE (succ, ei, block->succs) { ! if (bitmap_set_contains_value (PA_IN (succ->dest), val)) { if (optimize_edge_for_speed_p (succ)) do_insertion = true; --- 3525,3532 ---- may cause regressions on the speed path. */ FOR_EACH_EDGE (succ, ei, block->succs) { ! if (bitmap_set_contains_value (PA_IN (succ->dest), val) ! || bitmap_set_contains_value (ANTIC_IN (succ->dest), val)) { if (optimize_edge_for_speed_p (succ)) do_insertion = true;