Skip to content

@inline and deterministic results #2115

Closed
@lexaknyazev

Description

@lexaknyazev

Usually, the compiler makes its own assessment whether a function should be inlined at call-sites. However one could force it with an @inline decoration.

For some reason, adding the decoration to already-to-be-inlined functions sometimes lead to surprisingly different compilation output with two notable variations:

  1. Increased number of local variables at call-site (although the callee is inlined anyway).
  2. Inverted loop conditions, i.e., for (let i: u32 = 0; i < c; i++) the compiler puts the variables in reverse order and emits i32.gt_u.

Although these variations are quite minor, they sometimes decrease runtime performance and make debugging more difficult.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions