This is an archive of the discontinued LLVM Phabricator instance.

[SPIRV] Fix call lowering of "anonymous" functions
ClosedPublic

Authored by mpaszkowski on Oct 6 2022, 12:54 PM.

Details

Summary

The patch fixes lowering of anonymous functions, removes file/linkage info for builtin call demangling, and adds relevant test demonstrating a fixed problem. This patch fixes several OpenCL CTS spirv_new subtests.

Diff Detail

Event Timeline

mpaszkowski created this revision.Oct 6 2022, 12:54 PM
mpaszkowski requested review of this revision.Oct 6 2022, 12:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 6 2022, 12:54 PM
andreytr added a comment.EditedOct 6 2022, 1:18 PM

Suggest format of lit tests as it is in existing ones.

llvm/test/CodeGen/SPIRV/function/internal-anonymous-function.ll
4–8
arsenm added inline comments.Oct 6 2022, 7:23 PM
llvm/lib/Target/SPIRV/SPIRVAsmPrinter.cpp
467

This should probably be report_fatal_error

llvm/lib/Target/SPIRV/SPIRVMCInstLower.cpp
34

Does getFuncReg really handle the null case?

mpaszkowski marked 3 inline comments as done.Oct 8 2022, 7:16 PM

Updated the patch with the following changes:

  • Corrected formatting of the LIT test to match the style of other tests.
  • Changed llvm_unreachable to report_fatal_error.
  • Extracted some duplicate code into an util getFunctionGlobalIdentifier function.
  • Added (for now) an assert masking sure the function passed into getFuncReg is not nullptr. Will rework some of this in the upcoming patch.

Thank you @andreytr and @arsenm for comments!

iliya-diyachkov accepted this revision.Oct 9 2022, 12:35 PM

It looks good to me. Thank you for the patch, Michal.

This revision is now accepted and ready to land.Oct 9 2022, 12:35 PM
This revision was automatically updated to reflect the committed changes.