Skip to content

Support for lowering goto dialect into llvm IR #772

@kumarak

Description

@kumarak

Prerequisites

  • I have read the documentation and the proposed feature is not implemented.

Description

Vast IRsToLLVM pass does not support replacement of high-level goto dialect and it is marked illegal. I see the following error while generating llvm ir from code snippet containing goto.

test.c:6:5: error: unexpected error: failed to legalize operation 'hl.goto' that was explicitly marked illegal
    goto basic_0;
    ^
test.c:6:5: error: unexpected note: see current operation: "hl.goto"(%0) : (!hl.label) -> ()
    goto basic_0;
    ^
// -----// IR Dump After IRsToLLVM Failed (vast-irs-to-llvm) //----- //
module {
  core.module @"/Users/akshayk/Documents/workspace/demo/vast/build/test.c" attributes {dlti.dl_spec = #dlti.dl_spec<>, vast.core.lang = #core<lang c>, vast.core.target_triple = "arm64-apple-macosx15.0.0"} {
    hl.var @var_error, <internal>  sc_static : !hl.ptr<ui32>
    hl.var @var_1, <internal>  sc_static : !hl.ptr<ui32>
    ll.func @func external () -> ui32 {
      %0 = hl.label.decl @basic_0 : !hl.label
      %1 = hl.label.decl @basic_2 : !hl.label
      %2 = hl.label.decl @basic_1 : !hl.label
      %3 = ll.alloca : !hl.ptr<ui32>
      hl.goto %0
      hl.label %1 {
        %5 = hl.const #core.integer<0> : ui32
        ll.store %3, %5 : !hl.ptr<ui32>, ui32
      }
      %4 = ll.load %3 : (!hl.ptr<ui32>) -> ui32
      ll.return %4 : ui32
    }
  }
}


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