From: Aldy Hernandez Date: Thu, 14 Oct 2021 13:00:46 +0000 (+0200) Subject: Add FIXME note to backward threader. X-Git-Tag: basepoints/gcc-13~3913 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27dea0b42c773a53817960d006160642892fe145;p=thirdparty%2Fgcc.git Add FIXME note to backward threader. There's a limitation in the path discovery bits in the backward threader that I ran into recently and I'd like to document it so we don't lose track of it. Basically we stop looking if we find a threadable path through a PHI, without taking into account that there could be multiple paths through a PHI that resolve the path. For example: x_5 = PHI <10(4), 20(5), ...> if (x_5 > 5) I don't remember how we ended up skipping this, but it could existing behavior from the old bits. It probably skipped multiple threads through a PHI since the generic copier couldn't re-using existing threading paths anyhow. Documenting for later fixing. gcc/ChangeLog: * tree-ssa-threadbackward.c (back_threader::resolve_phi): Add FIXME note. --- diff --git a/gcc/tree-ssa-threadbackward.c b/gcc/tree-ssa-threadbackward.c index 28c7ef8c872b..496b68e0a823 100644 --- a/gcc/tree-ssa-threadbackward.c +++ b/gcc/tree-ssa-threadbackward.c @@ -282,6 +282,13 @@ back_threader::resolve_phi (gphi *phi, bitmap interesting) continue; } + // FIXME: We currently stop looking if we find a threadable path + // through a PHI. This is pessimistic, as there can be multiple + // paths that can resolve the path. For example: + // + // x_5 = PHI <10(4), 20(5), ...> + // if (x_5 > 5) + tree arg = gimple_phi_arg_def (phi, i); if (TREE_CODE (arg) == SSA_NAME) {