[PATCH] D130856: [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.

Xiang Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 1 09:50:54 PDT 2022


python3kgae added a comment.

In D130856#3691062 <https://reviews.llvm.org/D130856#3691062>, @beanz wrote:

> At first glance this seems like the wrong solution. Initialization of the DirectX target should not be initializing common LLVM code.
>
> Are the other LLVM library initializers not being called somewhere that is causing you to hit this issue?

addPassesToGenerateCode is not called. Since we don't do real code gen.
That's where createPassConfig is called which calls initializeCodeGen.

Maybe we can initialize these passes for AsmPrinter in DirectXTargetMachine::addPassesToEmitFile instead of initalizeCodeGen which will initialize a lot of passes we don't need.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130856/new/

https://reviews.llvm.org/D130856



More information about the llvm-commits mailing list