[PATCH] D69778: Make -fmodules-codegen and -fmodules-debuginfo work also with precompiled headers

Alexandre Ganea via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 26 08:39:02 PDT 2020


aganea added a comment.

In D69778#2035805 <https://reviews.llvm.org/D69778#2035805>, @llunak wrote:

> @aganea Have you tried how this version of the patch affects PR44953? If not, could you please try?


I've applied the patch, I don't see the issue raised in PR44953 anymore.

However as discussed offline with @llunak I'm just raising a concern: when building with this patch + D69585 <https://reviews.llvm.org/D69585> (`-fpch-instantiate-templates`) + `-fmodules-debuginfo -fmodules-codegen` as instructed, the PCH compilation in one of games crashes with the callstack below. On another game, the compilation succeeds, but I can see link errors for a few symbols referenced from the .PCH.OBJ.

This patch may be fine on its own, because `-fmodules-debuginfo -fmodules-codegen` are not enabled by default with `/Yc`, but more work is needed to make this feature the default. This could be done in a subsequent patch.

  Unknown code
  UNREACHABLE executed at D:\llvm-project\llvm\lib\CodeGen\SelectionDAG\TargetLowering.cpp:5726!
  Stack dump:
  0.    Program arguments: -cc1 -triple x86_64-pc-windows-msvc19.20.0 -emit-obj (edited) -building-pch-with-obj -fpch-instantiate-templates -fmodules-codegen -fmodules-debuginfo -include-pch D:\(edited)\MyProject.pch -pch-through-header=(edited)\precomp.h -include (edited)\precomp.h (edited) -fms-compatibility-version=19.20 -std=c++17 -fdelayed-template-parsing -finline-functions -fobjc-runtime=gcc -fdiagnostics-show-option -fdiagnostics-absolute-paths -vectorize-loops -vectorize-slp -O3 -faddrsig -o D:\(edited)\MyProject.pch.obj -x c++ D:\(edited)\precomp.cpp
  1.    <eof> parser at end of file
  2.    Code generation
  3.    Running pass 'Function Pass Manager' on module '(edited)\precomp.cpp'.
  4.    Running pass 'X86 DAG->DAG Instruction Selection' on function '@"?GetDeterminant at Matrix44f@MyNamespace@@QEBAMXZ"'
  #0 0x00007ff6bada1c06 HandleAbort D:\llvm-project\llvm\lib\Support\Windows\Signals.inc:408:0
  #1 0x00007ff6beb4b0e1 raise D:\llvm-project\build64_stage0\minkernel\crts\ucrt\src\appcrt\misc\signal.cpp:547:0
  #2 0x00007ff6beb40e5c abort D:\llvm-project\build64_stage0\minkernel\crts\ucrt\src\appcrt\startup\abort.cpp:71:0
  #3 0x00007ff6bad58207 llvm::llvm_unreachable_internal(char const *, char const *, unsigned int) D:\llvm-project\llvm\lib\Support\ErrorHandling.cpp:210:0
  #4 0x00007ff6bbb14d2e llvm::TargetLowering::getNegatedExpression(class llvm::SDValue, class llvm::SelectionDAG &, bool, bool, unsigned int) const D:\llvm-project\llvm\lib\CodeGen\SelectionDAG\TargetLowering.cpp:5726:0
  #5 0x00007ff6bba1dd26 llvm::X86TargetLowering::getNegatedExpression(class llvm::SDValue, class llvm::SelectionDAG &, bool, bool, unsigned int) const D:\llvm-project\llvm\lib\Target\X86\X86ISelLowering.cpp:42707:0
  #6 0x00007ff6bbb140b3 llvm::TargetLowering::getNegatedExpression(class llvm::SDValue, class llvm::SelectionDAG &, bool, bool, unsigned int) const D:\llvm-project\llvm\lib\CodeGen\SelectionDAG\TargetLowering.cpp:5671:0
  #7 0x00007ff6bba1dd26 llvm::X86TargetLowering::getNegatedExpression(class llvm::SDValue, class llvm::SelectionDAG &, bool, bool, unsigned int) const D:\llvm-project\llvm\lib\Target\X86\X86ISelLowering.cpp:42707:0
  #8 0x00007ff6bbb1496c llvm::TargetLowering::getNegatedExpression(class llvm::SDValue, class llvm::SelectionDAG &, bool, bool, unsigned int) const D:\llvm-project\llvm\lib\CodeGen\SelectionDAG\TargetLowering.cpp:5643:0
  #9 0x00007ff6bba1dd26 llvm::X86TargetLowering::getNegatedExpression(class llvm::SDValue, class llvm::SelectionDAG &, bool, bool, unsigned int) const D:\llvm-project\llvm\lib\Target\X86\X86ISelLowering.cpp:42707:0
  #10 0x00007ff6bbb1496c llvm::TargetLowering::getNegatedExpression(class llvm::SDValue, class llvm::SelectionDAG &, bool, bool, unsigned int) const D:\llvm-project\llvm\lib\CodeGen\SelectionDAG\TargetLowering.cpp:5643:0
  #11 0x00007ff6bba1dd26 llvm::X86TargetLowering::getNegatedExpression(class llvm::SDValue, class llvm::SelectionDAG &, bool, bool, unsigned int) const D:\llvm-project\llvm\lib\Target\X86\X86ISelLowering.cpp:42707:0
  #12 0x00007ff6bbb14538 llvm::TargetLowering::getNegatedExpression(class llvm::SDValue, class llvm::SelectionDAG &, bool, bool, unsigned int) const D:\llvm-project\llvm\lib\CodeGen\SelectionDAG\TargetLowering.cpp:5708:0
  #13 0x00007ff6bba1dd26 llvm::X86TargetLowering::getNegatedExpression(class llvm::SDValue, class llvm::SelectionDAG &, bool, bool, unsigned int) const D:\llvm-project\llvm\lib\Target\X86\X86ISelLowering.cpp:42707:0
  #14 0x00007ff6bca4c6fb `anonymous namespace'::DAGCombiner::visit D:\llvm-project\llvm\lib\CodeGen\SelectionDAG\DAGCombiner.cpp:1573:0
  #15 0x00007ff6bca30e4b `anonymous namespace'::DAGCombiner::combine D:\llvm-project\llvm\lib\CodeGen\SelectionDAG\DAGCombiner.cpp:1634:0
  #16 0x00007ff6bca3052f llvm::SelectionDAG::Combine(enum llvm::CombineLevel, class llvm::AAResults *, enum llvm::CodeGenOpt::Level) D:\llvm-project\llvm\lib\CodeGen\SelectionDAG\DAGCombiner.cpp:21222:0
  #17 0x00007ff6bbb3729b llvm::SelectionDAGISel::CodeGenAndEmitDAG(void) D:\llvm-project\llvm\lib\CodeGen\SelectionDAG\SelectionDAGISel.cpp:816:0
  #18 0x00007ff6bbb36d1b llvm::SelectionDAGISel::SelectBasicBlock(class llvm::ilist_iterator<struct llvm::ilist_detail::node_options<class llvm::Instruction, 1, 0, void>, 0, 1>, class llvm::ilist_iterator<struct llvm::ilist_detail::node_options<class llvm::Instruction, 1, 0, void>, 0, 1>, bool &) D:\llvm-project\llvm\lib\CodeGen\SelectionDAG\SelectionDAGISel.cpp:736:0
  #19 0x00007ff6bbb36657 llvm::SelectionDAGISel::SelectAllBasicBlocks(class llvm::Function const &) D:\llvm-project\llvm\lib\CodeGen\SelectionDAG\SelectionDAGISel.cpp:1611:0
  #20 0x00007ff6bbb32558 llvm::SelectionDAGISel::runOnMachineFunction(class llvm::MachineFunction &) D:\llvm-project\llvm\lib\CodeGen\SelectionDAG\SelectionDAGISel.cpp:504:0
  #21 0x00007ff6bb8e2b0a `anonymous namespace'::X86DAGToDAGISel::runOnMachineFunction D:\llvm-project\llvm\lib\Target\X86\X86ISelDAGToDAG.cpp:195:0
  #22 0x00007ff6baf8d2de llvm::MachineFunctionPass::runOnFunction(class llvm::Function &) D:\llvm-project\llvm\lib\CodeGen\MachineFunctionPass.cpp:73:0
  #23 0x00007ff6ba9ff6d2 llvm::FPPassManager::runOnFunction(class llvm::Function &) D:\llvm-project\llvm\lib\IR\LegacyPassManager.cpp:1481:0
  #24 0x00007ff6ba9ffa13 llvm::FPPassManager::runOnModule(class llvm::Module &) D:\llvm-project\llvm\lib\IR\LegacyPassManager.cpp:1517:0
  #25 0x00007ff6baa0009c llvm::legacy::PassManagerImpl::run(class llvm::Module &) D:\llvm-project\llvm\lib\IR\LegacyPassManager.cpp:1694:0
  #26 0x00007ff6bc02dc79 clang::EmitBackendOutput(class clang::DiagnosticsEngine &, class clang::HeaderSearchOptions const &, class clang::CodeGenOptions const &, class clang::TargetOptions const &, class clang::LangOptions const &, class llvm::DataLayout const &, class llvm::Module *, enum clang::BackendAction, class std::unique_ptr<class llvm::raw_pwrite_stream, struct std::default_delete<class llvm::raw_pwrite_stream>>) D:\llvm-project\clang\lib\CodeGen\BackendUtil.cpp:1550:0
  #27 0x00007ff6bc397f9d clang::BackendConsumer::HandleTranslationUnit(class clang::ASTContext &) D:\llvm-project\clang\lib\CodeGen\CodeGenAction.cpp:339:0
  #28 0x00007ff6bd9e2193 clang::ParseAST(class clang::Sema &, bool, bool) D:\llvm-project\clang\lib\Parse\ParseAST.cpp:178:0
  #29 0x00007ff6bc2f88f4 clang::FrontendAction::Execute(void) D:\llvm-project\clang\lib\Frontend\FrontendAction.cpp:940:0
  #30 0x00007ff6bae9e4bb clang::CompilerInstance::ExecuteAction(class clang::FrontendAction &) D:\llvm-project\clang\lib\Frontend\CompilerInstance.cpp:965:0
  #31 0x00007ff6baefed5c clang::ExecuteCompilerInvocation(class clang::CompilerInstance *) D:\llvm-project\clang\lib\FrontendTool\ExecuteCompilerInvocation.cpp:290:0
  #32 0x00007ff6ba62798e cc1_main(class llvm::ArrayRef<char const *>, char const *, void *) D:\llvm-project\clang\tools\driver\cc1_main.cpp:240:0
  #33 0x00007ff6ba6249e5 ExecuteCC1Tool D:\llvm-project\clang\tools\driver\driver.cpp:329:0
  #34 0x00007ff6ba624688 main D:\llvm-project\clang\tools\driver\driver.cpp:403:0
  #35 0x00007ff6beb2cdd0 __scrt_common_main_seh d:\A01\_work\6\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288:0
  #36 0x00007ff93be17bd4 (C:\WINDOWS\System32\KERNEL32.DLL+0x17bd4)
  #37 0x00007ff93bfeced1 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x6ced1)


Repository:
  rC Clang

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

https://reviews.llvm.org/D69778





More information about the cfe-commits mailing list