Skip to content
HALOWERK

Codewerk

cfg loop invariant hoist candidates

Find loop operations whose operands become invariant and whose declared effects permit speculative hoisting.

POST https://code.halowerk.com/v1/cfg-loop-invariant-hoist-candidates

Inputs

Fields of the published input schema
FieldTypeRequiredDescription
invariant_variablesarrayYes
operationsarrayYes
Show full input schema
{
  "type": "object",
  "properties": {
    "invariant_variables": {
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 32,
        "minLength": 1
      },
      "maxItems": 32,
      "minItems": 0
    },
    "operations": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 32,
            "minLength": 1
          },
          "target": {
            "type": "string",
            "maxLength": 32,
            "minLength": 1
          },
          "operands": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 32,
              "minLength": 1
            },
            "maxItems": 32,
            "minItems": 0
          },
          "pure": {
            "type": "boolean"
          },
          "safe_to_speculate": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "target",
          "operands",
          "pure",
          "safe_to_speculate"
        ],
        "additionalProperties": false
      },
      "maxItems": 32,
      "minItems": 0
    }
  },
  "required": [
    "invariant_variables",
    "operations"
  ],
  "additionalProperties": false
}

Open original schema

Published input example

{
  "invariant_variables": [
    "x"
  ],
  "operations": [
    {
      "id": "b",
      "target": "y",
      "operands": [
        "x"
      ],
      "pure": true,
      "safe_to_speculate": true
    },
    {
      "id": "c",
      "target": "z",
      "operands": [
        "y"
      ],
      "pure": true,
      "safe_to_speculate": false
    }
  ]
}

Result & documentation

Machine-readable documentation of this hub

Source of this page: the published HALOWERK catalog. Updated: 2026-11-18 UTC.

More endpoints in this hub

All endpoints in this hub โ†’