Skip to content

AOT: enum match($this) compile outcome depends on helper-cache state — same commit both compiles and fails module verification #24388

Description

@PurHur

Summary

m04_enum_match_this and k06_enum_backed_match compile successfully in some runs and fail LLVM
module verification in others — on the same commit, same image, same source:

PHP Fatal error: Uncaught RuntimeException: Module verification failed due to
                 PHI node entries do not match predecessors!

The determining factor appears to be the helper-runtime cache state, not the code.

Evidence

Two full differential sweeps, both cold-started, both on master around a279902fc:

sweep A:  ok      m04_enum_match_this.php   (3/3 runs)     ok      k06_...  (3/3 runs)
sweep B:  COMPILE m04_enum_match_this.php                  COMPILE k06_...

Single-shot compiles of m04 right now return the PHI error at every commit I tested:

a279902fc  phi_error=1      dac8065a0  phi_error=1
64d006e75  phi_error=1      c5b12a6b4  phi_error=1
33b43eea8  phi_error=1      e051bd155  phi_error=1
84565e364  phi_error=1      master     phi_error=1

Including a279902fc — the commit where sweep A reported ok 3/3. So this is not commit-linked,
and bisecting it is a dead end.

What differs between the runs

Sweep A ran script/aot-smoke.sh first, which warms build/helper-runtime-cache with units emitted
during that run. Sweep B (and my single-shot checks) ran against a cache in a different state.

I tried to pin it to committed-prelinked-vs-freshly-emitted units and that hypothesis was
refuted
— with PHP_COMPILER_HELPER_RUNTIME_CACHE_DIR pointed at a fresh temp dir, both paths
fail:

A: committed prelinked units        phi_errors=1, no binary
B: after emit-helper-runtime-object.php  phi_errors=1, no binary

So the cache state matters, but "which tier of units" is not the whole story, and I would rather say
that than guess further.

Why this is worth its own issue

  1. A compile outcome that depends on cache state is a correctness problem, independent of the
    enum bug underneath it. The same source must compile the same way.
  2. It makes the sweep an unreliable gate for these cases — they can land in the failing set or
    not depending on cache history, which is exactly the class of noise that produces phantom
    regressions. I hit this: two of my baselines disagreed on these two cases and I initially read it
    as a same-day regression.
  3. #24163 is closed with these cases red. They currently fail on master.

Suggested next step

Dump the IR for the failing function under both cache states and diff it — the PHI node with
mismatched predecessors should be identifiable, and whether its predecessor set differs by cache
tier would say whether this is a lowering bug exposed by unit selection or a unit-linking bug.

Environment: php-compiler:22.04-dev, PHP 8.2.32, LLVM 9, master 235e9d7f2. Cases:
test/differential/cases/m04_enum_match_this.php, k06_enum_backed_match.php.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions