[PATCH] D159339: [urgent][CodeGen] First check the kind and then the llvm::Function properties.

Vassil Vassilev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 5 10:53:12 PDT 2023


v.g.vassilev added a subscriber: Hahnfeld.
v.g.vassilev added a comment.

The issue goes away for non-CXXMethodDecls but still persists in the case where we process:

  CXXDestructorDecl 0x9ab0f48 </usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr.h:121:11> col:11 implicit used ~shared_ptr 'void () noexcept' inline default
  `-CompoundStmt 0x9ac3ca0 <col:11>

Here is a bt:

  #0  llvm::Value::getPointerAlignment (this=0x9dcbed8, DL=...) at /home/vvassilev/workspace/sources/llvm-project/llvm/lib/IR/Value.cpp:923
  #1  0x0000000001b32b52 in clang::CodeGen::CodeGenModule::SetLLVMFunctionAttributesForDefinition (this=0x885e3c0, D=0x9ab0f48, F=0x9dcbed8)
      at /home/vvassilev/workspace/sources/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:2389
  #2  0x0000000001d40899 in clang::CodeGen::CodeGenModule::codegenCXXStructor (this=0x885e3c0, GD=...)
      at /home/vvassilev/workspace/sources/llvm-project/clang/lib/CodeGen/CGCXX.cpp:211
  #3  0x0000000001bbffd5 in (anonymous namespace)::ItaniumCXXABI::emitCXXStructor (this=0x885f2f0, GD=...)
      at /home/vvassilev/workspace/sources/llvm-project/clang/lib/CodeGen/ItaniumCXXABI.cpp:4453
  #4  0x0000000001b36ffb in clang::CodeGen::CodeGenModule::EmitGlobalDefinition (this=this at entry=0x885e3c0, GD=..., GV=GV at entry=0x9dcbed8)
      at /home/vvassilev/workspace/sources/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:3893
  #5  0x0000000001b2a9a0 in clang::CodeGen::CodeGenModule::EmitDeferred (this=this at entry=0x885e3c0)
      at /home/vvassilev/workspace/sources/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:3050
  #6  0x0000000001b2a9cc in clang::CodeGen::CodeGenModule::EmitDeferred (this=this at entry=0x885e3c0)
      at /home/vvassilev/workspace/sources/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:3056
  #7  0x0000000001b285bb in clang::CodeGen::CodeGenModule::Release (this=0x885e3c0)
      at /home/vvassilev/workspace/sources/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:759
  #8  0x0000000001882908 in (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit (this=0x87c6430, Ctx=...)
      at /home/vvassilev/workspace/sources/llvm-project/clang/lib/CodeGen/ModuleBuilder.cpp:287
  #9  0x000000000186e3a6 in clang::BackendConsumer::HandleTranslationUnit (this=0x87c6080, C=...)
      at /home/vvassilev/workspace/sources/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:311
  #10 0x0000000000f7bdc7 in clang::IncrementalParser::ParseOrWrapTopLevelDecl (this=this at entry=0x87603c0)
      at /home/vvassilev/workspace/sources/llvm-project/clang/lib/Interpreter/IncrementalParser.cpp:303
  #11 0x0000000000f7c760 in clang::IncrementalParser::Parse (this=0x87603c0, input=...)
      at /home/vvassilev/workspace/sources/llvm-project/clang/lib/Interpreter/IncrementalParser.cpp:342
  #12 0x0000000000f70c79 in clang::Interpreter::Parse (this=0x875d170, Code=...)
      at /home/vvassilev/workspace/sources/llvm-project/clang/lib/Interpreter/Interpreter.cpp:360
  #13 0x0000000000e28b11 in Cpp::Interpreter::Parse (this=0x86e9cf0, Code=...)
      at /home/vvassilev/workspace/builds/scratch/cppyy/InterOp/include/clang/Interpreter/CppInterOpInterpreter.h:172
  #14 0x0000000000e28b84 in Cpp::Interpreter::declare (this=0x86e9cf0, 
      input="\n    #include <memory>\n\n    template<typename T>\n    class derived_shared_ptr : public std::shared_ptr<T> {};\n    template<typename T>\n    class derived_unique_ptr : public std::unique_ptr<T> {};\n\n   "..., PTU=0x0)

I am staring at the `Value::getPointerAlignment(const DataLayout &DL)` and cannot find out what might be wrong. One particularity of the clang-repl based workflows is that it calls multiple times `StartModule`, which creates a new `llvm::Module` per partial translation unit.

cc: @Hahnfeld


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159339



More information about the cfe-commits mailing list