Skip to content

Global vars in modules without functions may be incorrectly processed #68

@iliya-diyachkov

Description

@iliya-diyachkov

We introduced empty kernel test_atomic_fn() in capability-integers.ll to force processing of global variables and passing the test since modules without functions are not processed properly (see #66 ). Probably we need to add a fake function automatically for each module without functions.

Another test without functions is transcoding/global-constant-expression.ll. By the way if I add empty function to it, its compilation fails with "Assertion `!hasDefs || resType || I.getOpcode() == TargetOpcode::G_GLOBAL_VALUE' failed" in SPIRVInstructionSelector.cpp:282. Actually the opcode is G_PTR_ADD which we get after IRTranslator:

  %10:_(p1) = G_PTR_ADD %8:_, %11:anyid(s32)
  %12:_(p1) = COPY %8:_(p1)
  %14:_(p1) = G_GLOBAL_VALUE @k_var
  %22:anyid(s32) = G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.spv.const.composite), %4:anyid(s8), %4:anyid(s8)
  %23:type(s32) = OpTypeArray %16:type(s32), %18:id(s32)
  %6:anyid(s32) = ASSIGN_TYPE %22:anyid(s32), %23:type(s32)
  G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.spv.init.global), %8:_(p1), %6:anyid(s32)
  %15:anyid(s32) = G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.spv.const.composite), %10:_(p1), %12:_(p1)

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