This series fixes PR128102, where the state-machine loop in CPython's
binascii_a2b_base64 regressed from ~2.1 to ~4.1 cycles/byte between
GCC 11 and GCC 12.
The backward jump threader fails to thread the loop because
pass_lower_switch has already lowered the GIMPLE_SWITCH into a decision
tree by the time the late FSM threading runs, and the duplication
limits are tight for the resulting branch sequence. Patch 1 moves
pass_lower_switch after pass_thread_jumps_full so the backward threader
still sees the switch; pass_dominator and pass_strlen keep their place
relative to the jump threaders, so the only change is the position of
pass_lower_switch.
Moving the lowering changes the control flow seen by the
-Wuninitialized warning pass and exposes two latent false positives
(PR107919 and PR44547). Patch 2 fixes uninit_analysis::is_use_guarded,
which wrongly treats an empty (unconditional) use predicate as an
unguarded use; an unconditional use is now guarded exactly when its
definition predicate is TRUE.
Changes since v1:
- Patch 2/2: in the fallback path, a definition predicate that
simplifies to TRUE (the value is defined on every path) now guards
any use, not just an unconditional one. v1 checked only the
superset relation there, which is vacuous for a TRUE predicate and so
missed the conditional-use case. (Spotted by Sashiko.)
Bootstrapped and regression-tested on x86_64-linux-gnu and
aarch64-linux-gnu (bootstrap-debug, stage2/stage3 compare clean;
check-c and check-c++). PR44547 and PR107919 pass on both. The
remaining unexpected failures on each target are pre-existing and
unrelated to this series.
Sendao Yan
Sendao Yan (2):
tree-optimization/128102 - lower switches after the late jump
threading
tree-optimization/128102 - fix -Wuninitialized FPs from lowering
switches late
gcc/gimple-predicate-analysis.cc | 40 +++++++++----
gcc/passes.def | 4 +-
gcc/testsuite/gcc.dg/tree-ssa/pr128102.c | 69 ++++++++++++++++++++++++
3 files changed, 101 insertions(+), 12 deletions(-)
create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr128102.c
--
2.34.1