Skip to content

LICM: hoist calls to pure libm functions (-ftrust-libm) and relax CSE after them #44

Open

Description

@AananthV

Follow-up to #12 phase 2. This is verified-only work: the trusted semantics are already in place (ledger entry 8).

  1. LICM hoisting of EF_runtime libm calls: about 700-900 lines, mostly proof.
    • A hoist may be an Icall to a known pure runtime function.
    • The preheader executes it; this is safe because libm_icall_progress shows the call always succeeds.
    • In-loop calls become moves.
    • LICM needs the defmap, as CSE has.
    • Motivation: perlin's floor(x)/floor(y) are invariant in the inner loop (a hand-written version gave about −20%).
  2. CSE kill_cheap_computations: keep equations across pure libm calls, so recomputed arguments such as constants or (float)x are shared. In scratch this re-proved with no proof change; it needs benchmarking.

Note the errno policy (GCC's -fno-math-errno): with LICM, a hoisted call may run when the source's loop does not.

Activity

  1. added
    faster-compcert
    tier-1: verified
    on Oct 24, 2026
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

    faster-compcerttier-1: verified

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions