[all-commits] [llvm/llvm-project] 20f7f9: [NFC][DirectX backend] Fix crash when emit_obj for...

Xiang Li via All-commits all-commits at lists.llvm.org
Tue Aug 2 12:09:22 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 20f7f9b709dfb1dafd6827c9708928ecac547d87
  Author: Xiang Li <python3kgae at outlook.com>
  Date:   2022-08-02 (Tue, 02 Aug 2022)

  Changed paths:
    M llvm/lib/Target/DirectX/DirectXAsmPrinter.cpp
    M llvm/lib/Target/DirectX/DirectXTargetMachine.cpp

  Log Message:
  [NFC][DirectX backend] Fix crash when emit_obj for DirectX backend.

When emit-obj from clang directly, DirectX backend will hit assert caused by not initialize passes for AsmPrinter.
The fix will initialize the passes by calling createPassConfig.
Also ignore global variable which not has section in DXILAsmPrinter::emitGlobalVariable to avoid hit llvm_unreachable in DXILTargetObjectFile::SelectSectionForGlobal.

Reviewed By: beanz

Differential Revision: https://reviews.llvm.org/D130856

More information about the All-commits mailing list