Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ROOT's llvm to llvm13. #10294

Merged
merged 154 commits into from
Dec 9, 2022
Merged

Commits on Dec 9, 2022

  1. Configuration menu
    Copy the full SHA
    680a1dc View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    bd5d1c4 View commit details
    Browse the repository at this point in the history
  3. Revert "PR44540: Prefer an inherited default constructor over an init…

    …ializer list constructor when initializing from {}."
    
    This reverts commit cf32d2b; it's part of the llvm upgrade.
    Axel-Naumann authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    8dab1ca View commit details
    Browse the repository at this point in the history
  4. Revert "Add support for profiling/debugging interpreted/JITted code"

    This reverts commit 22b1606 until it
    is re-implemented on top of the changes for upgrading to LLVM 13.
    hahnjo authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    4e09a7b View commit details
    Browse the repository at this point in the history
  5. Import llvm13.

    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    ab2b972 View commit details
    Browse the repository at this point in the history
  6. Add getSizeExpr parameter.

    See llvm-project/llvm@772e266fbff40a566c9ef2d805c057c4692ac028
    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    8901c3c View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    659e946 View commit details
    Browse the repository at this point in the history
  8. Color handling moved from raw_fd_ostream to raw_ostream.

    We do not need the wrapper which did more than needed.
    
    See llvm/llvm-project@8744d7f
    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    99753bf View commit details
    Browse the repository at this point in the history
  9. The mangler accepts GlobalDecls and we don't need special cases ctors…

    … and dtors.
    
    See llvm/llvm-project/29e1a16be8216066d1ed733a763a749aed13ff47
    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    c0537a6 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    8c9aeef View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    9695067 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    f052ec0 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    df8be7e View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    e437d2f View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    eeaa511 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    81d582b View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    a58013d View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    fb02de5 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    0008ca6 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    86d58b2 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    d87fab7 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    6d72b4d View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    2491e9e View commit details
    Browse the repository at this point in the history
  24. Configuration menu
    Copy the full SHA
    12f4cd1 View commit details
    Browse the repository at this point in the history
  25. Expr dependence was reworked and made protected.

    By default we should get no dependence, assert that instead.
    
    See llvm/llvm-project@ec3060c
    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    f1685d8 View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    30781f3 View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    34474dc View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    58251bc View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    6675734 View commit details
    Browse the repository at this point in the history
  30. Configuration menu
    Copy the full SHA
    3a1d108 View commit details
    Browse the repository at this point in the history
  31. Configuration menu
    Copy the full SHA
    786206e View commit details
    Browse the repository at this point in the history
  32. Configuration menu
    Copy the full SHA
    bb48d94 View commit details
    Browse the repository at this point in the history
  33. Rework the cling JIT to use the ORCv2 interface.

    The ORCv1 JIT was deprecated and removed in llvm13. The ORCv2 provides several
    benefits such as parallel compilation.
    weliveindetail authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    5c84515 View commit details
    Browse the repository at this point in the history
  34. Configuration menu
    Copy the full SHA
    0fe3edb View commit details
    Browse the repository at this point in the history
  35. Configuration menu
    Copy the full SHA
    b47e32c View commit details
    Browse the repository at this point in the history
  36. Configuration menu
    Copy the full SHA
    e1dd160 View commit details
    Browse the repository at this point in the history
  37. Configuration menu
    Copy the full SHA
    5adc69c View commit details
    Browse the repository at this point in the history
  38. Configuration menu
    Copy the full SHA
    3535c5c View commit details
    Browse the repository at this point in the history
  39. Configuration menu
    Copy the full SHA
    70948dd View commit details
    Browse the repository at this point in the history
  40. Configuration menu
    Copy the full SHA
    f0c0b5b View commit details
    Browse the repository at this point in the history
  41. Configuration menu
    Copy the full SHA
    d5dc5ce View commit details
    Browse the repository at this point in the history
  42. Configuration menu
    Copy the full SHA
    537efd8 View commit details
    Browse the repository at this point in the history
  43. setSuppressAllDiagnostics has no default anymore.

    Remove duplicate line of code.
    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    451fb89 View commit details
    Browse the repository at this point in the history
  44. Configuration menu
    Copy the full SHA
    ea36464 View commit details
    Browse the repository at this point in the history
  45. Configuration menu
    Copy the full SHA
    71f3dd3 View commit details
    Browse the repository at this point in the history
  46. Configuration menu
    Copy the full SHA
    c2afed6 View commit details
    Browse the repository at this point in the history
  47. Configuration menu
    Copy the full SHA
    e6945b3 View commit details
    Browse the repository at this point in the history
  48. Configuration menu
    Copy the full SHA
    541cbb5 View commit details
    Browse the repository at this point in the history
  49. Configuration menu
    Copy the full SHA
    3f38a7d View commit details
    Browse the repository at this point in the history
  50. Configuration menu
    Copy the full SHA
    6478455 View commit details
    Browse the repository at this point in the history
  51. Configuration menu
    Copy the full SHA
    93bdb2e View commit details
    Browse the repository at this point in the history
  52. Configuration menu
    Copy the full SHA
    0e15e32 View commit details
    Browse the repository at this point in the history
  53. Configuration menu
    Copy the full SHA
    52447a6 View commit details
    Browse the repository at this point in the history
  54. Configuration menu
    Copy the full SHA
    aa4c10c View commit details
    Browse the repository at this point in the history
  55. Configuration menu
    Copy the full SHA
    6460e95 View commit details
    Browse the repository at this point in the history
  56. Implement --debug-only option in order to easily dump LLVM debug output

    For example: `cling --debug-only="orc,jitlink"`
    weliveindetail authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    29f97bf View commit details
    Browse the repository at this point in the history
  57. OrcV2 is more strict with linkage.

    When we compile incremental inputs we store each input in a separate
    llvm::Module. In order to preserve the semantics, we make all symbols from
    each module with external linkage, that is, accessible from other modules.
    
    This model works well for almost all symbols, except for the clang-generated
    ones which have the same name. For example clang stores strings in variables
    `.strN` which may clash accross modules. Luckily, these strings are used within
    a single module and thus we can avoid the JIT error by keeping them with their
    non-external linkage.
    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    d1eb04f View commit details
    Browse the repository at this point in the history
  58. Drop the unused Interpreter::addSymbol function.

    It just adds to the complexity and confusion of the addSymbol implementation
    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    ce004ba View commit details
    Browse the repository at this point in the history
  59. Implement a solution to the JIT-owned llvm::Modules.

    When removing code, we need to recover Clang's CodeGen and this happens by
    iterating over the clang::Decls and the llvm::Module for a given Transaction in
    the TransactionUnloader.
    
    The problem is that now OrcV2 takes the ownership of the llvm::Module from the
    Transaction for itself and then it can notify us when the module was compiled on
    demand. Unfortuantely, there is no good way to guarantee that the same module
    will be attached to the same transaction. This approach allows the
    TransactionUnloader::unloadModule logic to recover CodeGen.
    
    In a longer term, when we switch to partial translation units from clang-repl
    we might be able to recover CodeGen without needing to know details about the
    generated llvm::Module.
    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    d5fee48 View commit details
    Browse the repository at this point in the history
  60. Configuration menu
    Copy the full SHA
    bfed0c8 View commit details
    Browse the repository at this point in the history
  61. Configuration menu
    Copy the full SHA
    56f94cc View commit details
    Browse the repository at this point in the history
  62. Configuration menu
    Copy the full SHA
    c927ad0 View commit details
    Browse the repository at this point in the history
  63. Configuration menu
    Copy the full SHA
    01f6cda View commit details
    Browse the repository at this point in the history
  64. Configuration menu
    Copy the full SHA
    a8af0ec View commit details
    Browse the repository at this point in the history
  65. Configuration menu
    Copy the full SHA
    df9346f View commit details
    Browse the repository at this point in the history
  66. LLVM now requires C++14.

    Patch by Lang Hames.
    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    748ba08 View commit details
    Browse the repository at this point in the history
  67. Configuration menu
    Copy the full SHA
    3841843 View commit details
    Browse the repository at this point in the history
  68. Diagnostic text changed

    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    1fc9b2a View commit details
    Browse the repository at this point in the history
  69. Re-teach getAddressOfGlobal to tell if something came from the JIT.

    This patch also inverts the parameter from ExcludeHostSymbols to
    IncludeHostSymbols to improve readability.
    
    As written in one of the FIXMEs this is a temporary solution which allows us to
    go further with the llvm-13 upgrade. We can rework the getAddress* functionality
    to reuse more the ORCV2 infrastructure and more importantly to use that
    infrastructure in the recommended way.
    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    25b174b View commit details
    Browse the repository at this point in the history
  70. Unconditionally install ClingTargets.cmake, required by ClingConfig.c…

    …make
    
    This fixes our -Dbuiltin_cling=Off option.
    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    6f4ef66 View commit details
    Browse the repository at this point in the history
  71. Configuration menu
    Copy the full SHA
    ce19b68 View commit details
    Browse the repository at this point in the history
  72. Configuration menu
    Copy the full SHA
    59a34cd View commit details
    Browse the repository at this point in the history
  73. isIntegerConstantExpression was refactored to getIntegerConstantExpre…

    …ssion.
    
    See llvm/llvm-prject@36036aa70ec1df7b51b5d30b2dd8090ad2b6e783
    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    159b2c7 View commit details
    Browse the repository at this point in the history
  74. Configuration menu
    Copy the full SHA
    9d20a0a View commit details
    Browse the repository at this point in the history
  75. Configuration menu
    Copy the full SHA
    99fadca View commit details
    Browse the repository at this point in the history
  76. Configuration menu
    Copy the full SHA
    20ccba3 View commit details
    Browse the repository at this point in the history
  77. Configuration menu
    Copy the full SHA
    a02057c View commit details
    Browse the repository at this point in the history
  78. Configuration menu
    Copy the full SHA
    01468cd View commit details
    Browse the repository at this point in the history
  79. Configuration menu
    Copy the full SHA
    50ae2eb View commit details
    Browse the repository at this point in the history
  80. Configuration menu
    Copy the full SHA
    5fafa1e View commit details
    Browse the repository at this point in the history
  81. Configuration menu
    Copy the full SHA
    22bda48 View commit details
    Browse the repository at this point in the history
  82. Configuration menu
    Copy the full SHA
    a50544d View commit details
    Browse the repository at this point in the history
  83. Use consistent TUKind for the Preproocessor and Sema.

    This fixes an assertion.
    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    3ed1815 View commit details
    Browse the repository at this point in the history
  84. Configuration menu
    Copy the full SHA
    3dcc1d6 View commit details
    Browse the repository at this point in the history
  85. Move handling of the help option alias after hinding all irrelevant o…

    …ptions.
    
    This fixes an option double registration assert.
    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    d428df2 View commit details
    Browse the repository at this point in the history
  86. Add another symbol generator to resolve the generated lazy symbol.

    The in-process symbol generator resolves symbols available in the process and
    all dlopened libraries. However, upon unresolved symbol, we trigger our lazy
    loading function creator callbacks which load the relevant library. Then we
    need another in-process symbol generator to catch the newly created symbol so
    that the JIT is happy.
    
    This solution is suboptimal and in the comments is provided a cleaner
    implementation, however, this implementation loads libraries for weak symbols
    that the JIT could generate. This needs to be further investigated.
    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    c6956cb View commit details
    Browse the repository at this point in the history
  87. Configuration menu
    Copy the full SHA
    71e6ed3 View commit details
    Browse the repository at this point in the history
  88. [cmake] Force-set the ZLIB_LIBRARY

    Apparently cmake sets the cache after the configuration is complete and using
    FORCE updates the cache at the spot including the relevant generator expressions.
    
    This fixes the case where we build ROOT with -Dbuiltin_zlib=Off and then LLVM
    sanity checks the found zlib issuing:
    
    ```
    Error evaluating generator expression:
    
      $<TARGET_FILE:ZLIB>
    
    No target "ZLIB"
    ```
    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    10e0b01 View commit details
    Browse the repository at this point in the history
  89. Do not install {Clang,Cling}Config.cmake in the project lib dir.

    This should fix the clad builds and unpollute the ROOTSYS/lib.
    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    2b283cc View commit details
    Browse the repository at this point in the history
  90. Try fixing the multicore

    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    5c3652a View commit details
    Browse the repository at this point in the history
  91. Use the header fullpath to fix a new diagnostic.

    When creating a dictionary we should either copy the header next to the
    modulemap file (in the build folder) or use full paths.
    
    This patch fixes new diagnostics from such kind:
    
    tree/dataframe/test/module.modulemap:3:33: error: cannot emit module dataframe_splitcoll_arrayview: size must be explicitly specified for missing header file "TwoFloats.h"
      module "TwoFloats.h" { header "TwoFloats.h" export * }
                                    ^
    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    3c11c24 View commit details
    Browse the repository at this point in the history
  92. Fix build with C++17

    When building with C++17, a llvm::StringRef can be implicitly converted
    to std::string_view. This causes an ambiguity when comparing a StringRef
    with a const char * because the compiler could either
     * convert the StringRef into a std::string_view and use the operator==
       from TString.h, taking std::string_view and const char*, or
     * construct a StringRef from the const char* and use the opertor==
       defined in StringRef.h.
    
    In TCling.cxx, we want to compare two StringRefs and can construct the
    StringRefs statically beforehand.
    hahnjo authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    e4beb9a View commit details
    Browse the repository at this point in the history
  93. Fix CUDA architecture selection

    --cuda-gpu-arch aliases --offload-arch, so the option parser will
    canonicalize to the latter.
    hahnjo authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    de84bfc View commit details
    Browse the repository at this point in the history
  94. [CUDA/HIP] Remove argument from module ctor/dtor signatures

    This works around a bug + missing support in ORC for constructors with
    non-void signatures (llvm/llvm-project#54797).
    Also submitted upstream, see https://reviews.llvm.org/D123370
    hahnjo authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    7a4c266 View commit details
    Browse the repository at this point in the history
  95. [cling] Do not externalize unnamed GlobalValues

    It doesn't make sense and the JIT crashes, see upstream bug report
    llvm/llvm-project#54813
    hahnjo authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    4f26cf7 View commit details
    Browse the repository at this point in the history
  96. [cling] Fix some trivial compiler warnings

    "moving a local object in a return statement prevents copy elision" as
    well as an unused variable and function referenced only from an assert.
    hahnjo authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    c4cf8b5 View commit details
    Browse the repository at this point in the history
  97. [cling] Move Autoload annotation after scope keyword

    Otherwise tests/Autoloading/AutoForwarding.C complains that "an
    attribute list cannot appear here".
    hahnjo authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    e0d8ff5 View commit details
    Browse the repository at this point in the history
  98. [cling] Print 'a<b<c> >' rather than 'a<b<c>>' in ValuePrinter

    See earlier commit for the Transform.C test.
    hahnjo authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    959fe3a View commit details
    Browse the repository at this point in the history
  99. [cling] The JIT now is more consistent on OSX with the linker-level m…

    …angling
    
    OSX (due to legacy to disambigate between asm and C symbols) implements an extra
    linker-level mangling which adds another `_` in the name. However, that is only
    in the on-disk representation and needs to be dropped upon calling dlsym.
    
    OrcV2 gives us a handle to the symbol with starts with `__` allowing us to
    invert the logic of the symbol search where we drop the `__` for dlsym.
    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    d307fb8 View commit details
    Browse the repository at this point in the history
  100. Configuration menu
    Copy the full SHA
    56dd0ba View commit details
    Browse the repository at this point in the history
  101. [cling] Fix emission of vtables

    It is (again) necessary to call DefineUsedVTables() to enable (at
    least) the emission of implicitly defined destructors overriding
    the virtual destructor in a base class, see the added test.
    hahnjo authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    e770ce4 View commit details
    Browse the repository at this point in the history
  102. Print 'a<b<c> >' rather than 'a<b<c>>' in TCling.

    See earlier commit for the cling/test/.../Transform.C.
    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    a5e3551 View commit details
    Browse the repository at this point in the history
  103. [cling] Ignore duplicate kept GlobalValues

    Set WeakAnyLinkage instead of ExternalLinkage to tell the JIT linker
    that it should not error on duplicate symbols.
    hahnjo authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    34e445d View commit details
    Browse the repository at this point in the history
  104. TClingMethodInfoTests: Delete unwanted constructor

    Starting with version 12, Clang seems to implicitly generate the
    Derived() constructor, calling Base1() and then Base2(). Older
    versions and GCC complain that the "call of overloaded 'Derived()'
    is ambiguous". It's not clear to me what is actually the correct
    behavior according to the C++ standard, so just delete the unwanted
    constructor for now.
    hahnjo authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    1501c97 View commit details
    Browse the repository at this point in the history
  105. [cling] Print default template arguments

    Fixes (at least) roottest-cling-stl-default-VectorSort and
    roottest-cling-templateMembers-runoperatorEqual.
    hahnjo authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    8688a92 View commit details
    Browse the repository at this point in the history
  106. [cling] Avoid duplicate symbols from RuntimeUniverse.h

    Make InterpreterGeneratedCodeDiagnosticsMaybeIncorrect static, which
    is then turned into a weak symbol by KeepLocalGVPass.
    hahnjo authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    19bd6d2 View commit details
    Browse the repository at this point in the history
  107. TCling: Print default template arguments

    Fixes the build of generated dictionaries.
    hahnjo authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    c8653bf View commit details
    Browse the repository at this point in the history
  108. [D126620][clang] AST/Print: honor AlwaysIncludeTypeForTemplateArgumen…

    …t policy.
    
    This redoes D103040 in a way that AlwaysIncludeTypeForTemplateArgument = false
    policy is honored for printing template specialization types.
    This can be seen for example when printing a canonicalized
    dependent TemplateSpecializationType which has integral arguments.
    
    Signed-off-by: Matheus Izvekov <[email protected]>
    
    This fixes:
    before:
    root.exe -l -b -q -e 'TClass::GetClass("std::array<int,3>")->Print()'
    OBJ: TClassarray<int,3UL>
    
    after: root.exe -l -b -q -e 'TClass::GetClass("std::array<int,3>")->Print()'
    OBJ: TClassarray<int,3>
    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    e83e150 View commit details
    Browse the repository at this point in the history
  109. [cling] Weaken definitions of typeinfos and vtables

    Introduce a backend pass that changes the linkage of external symbols
    starting with "_ZT" (ie. typeinfo names, typeinfos, and vtables) to
    weak symbols. This avoids duplicate symbol errors with the new JIT
    linker.
    
    FIXME: This is a hack, we should teach the frontend to emit these
    only once, or mark all duplicates as available_externally (if that
    improves performance due to optimizations).
    hahnjo authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    67da5f5 View commit details
    Browse the repository at this point in the history
  110. LLVM has now unnamed for enums and anonymous for everything else.

    See llvm-project/llvm@50542d504dd869fe1241a9cc987b72ead5a56073
    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    3edc949 View commit details
    Browse the repository at this point in the history
  111. Revert "Reland another version of "The Sema::LookupConstructor is not…

    … iteration safe.""
    
    This reverts commit 6494f1f.
    
    LLVM13 has fixed the issue of deserialization while performing lookups.
    
    See llvm/llvm-project@0cb7e7c
    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    2894a82 View commit details
    Browse the repository at this point in the history
  112. Configuration menu
    Copy the full SHA
    81086e6 View commit details
    Browse the repository at this point in the history
  113. Configuration menu
    Copy the full SHA
    4c7b512 View commit details
    Browse the repository at this point in the history
  114. [cling] Fix spelling of "we do not have a valid buffer":

    This was broken during the llvm upgrade, rewriting this condition.
    Axel-Naumann authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    b3c0401 View commit details
    Browse the repository at this point in the history
  115. [clang] Mark ContentCache as invalid if !Buffer:

    This behavior is consistent with the construction, and passing
    a nullptr is a technique to invalidate the cache.
    Axel-Naumann authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    8deb57c View commit details
    Browse the repository at this point in the history
  116. [cmake] Prevent race creating lib/:

    Co-authored-by: Bertrand Bellenot <[email protected]>
    On Windows, llvm and others want to create `lib/` causing errors. Instead,
    create the directory explicitly as part of the configuration.
    Axel-Naumann authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    6d08128 View commit details
    Browse the repository at this point in the history
  117. [cling] Silence Orc missing symbols message:

    IncrementalExecutor has its own, showing what is requesting the
    symbols, which is more useful than the diagnostic of Orc. OTOH
    Orc might emit more errors than just missing symbols, and if
    there are multiple missing symbols, IncrementalExecutor only
    shows the first.
    
    So enable `Verbose` also for IncrementalJIT, showing the original
    missing symbols as diagnosed by Orc.
    
    This fixes roottest_cling_other_checkMissingSymbolExitCode which
    fails due to the extra diagnostic error line.
    Axel-Naumann authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    5c5fa8a View commit details
    Browse the repository at this point in the history
  118. [clang] Revert interface (and use) to upstream llvm13:

    This was a diff we carried around without functional changes.
    Axel-Naumann authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    d207867 View commit details
    Browse the repository at this point in the history
  119. TCling: Re-implement autoload via MaterializationUnits

    Replace the existing LazyFunctionCreator interface by a function
    to add DefinitionGenerators to be passed via the chain Interpreter
    -> IncrementalExecutor -> IncrementalJIT.
    Implement a DefinitionGenerator in TCling(Callbacks) to define
    MaterializationUnits for autoloading symbols. This also allows to
    remove the double DynamicLibrarySearchGenerator now that the created
    AutoloadLibraryMUs inject the addresses into the JIT after loading
    the required library.
    hahnjo authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    9b2041e View commit details
    Browse the repository at this point in the history
  120. [TClingUtils] Remove leading underscore also for C symbols

    Not only applies to C++; the comment about using getGlobalPrefix()
    for this still holds.
    hahnjo authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    a5b68d6 View commit details
    Browse the repository at this point in the history
  121. Fixed bug in symbol linking for CUDA kernel registration with LLVM 13.

    Since cling was ported to LLVM 13, it is required that the
    `__cuda_register_globals` function and the `__cuda_fatbin_wrapper` and
    `__cuda_gpubin_handle` variables are unique when defining a CUDA kernel.
    Otherwise, the JIT is lazy and reuses the compiled version of
    `__cuda_register_globals`, `__cuda_fatbin_wrapper` and `__cuda_gpubin_handle`
    from the first CUDA kernel definition for all subsequent CUDA kernel
    definitions, which in practice means that the PTX code from the first kernel is
    re-registered each time.
    
    Increase the default CUDA SM level to 35 because SM 20 is deprecated or
    removed in the current CUDA SDK versions.
    SimeonEhrig authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    c327f48 View commit details
    Browse the repository at this point in the history
  122. Configuration menu
    Copy the full SHA
    5f60424 View commit details
    Browse the repository at this point in the history
  123. [llvm] Fix win32 mangling in OrcJIT v2:

    For some reason, neither JIT nor compiled symbols can be resolved without this patch,
    as if the mangling prefix for win32 is simply wrong for win32?
    Axel-Naumann authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    ed7ed96 View commit details
    Browse the repository at this point in the history
  124. Configuration menu
    Copy the full SHA
    d558473 View commit details
    Browse the repository at this point in the history
  125. [TCling] Fix assert on autoloading libNew:

    this is a full path, it will not start with "libNew".
    Axel-Naumann authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    7963d75 View commit details
    Browse the repository at this point in the history
  126. Configuration menu
    Copy the full SHA
    1843584 View commit details
    Browse the repository at this point in the history
  127. [cling] weak symbol re-emission veto: only consider in-process symbols:

    Asking for JIT symbols triggers autoloading. JIT symbols will be
    resolved by the JIT itself.
    Axel-Naumann authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    b5ceff2 View commit details
    Browse the repository at this point in the history
  128. Configuration menu
    Copy the full SHA
    6a145b3 View commit details
    Browse the repository at this point in the history
  129. [cling] Pass libCling handle at construction time, resolve from it:

    OrcV2 uses specific DyLibs to resolve symbols from, we need a dedicated
    resolver for libCling because its symbols cannot be found from the
    process.
    
    Remove now unused "ExposeHiddenSharedLibrarySymbols".
    Axel-Naumann authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    274c1d5 View commit details
    Browse the repository at this point in the history
  130. [cling] Formatting (80cols).

    Axel-Naumann authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    29597d6 View commit details
    Browse the repository at this point in the history
  131. [cling] Remove unused data members, parameters, includes.

    (cherry picked from commit 872d7c14d8c8e2883ed20a0b6c66a4bbafa4237d)
    Axel-Naumann authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    10ba5c3 View commit details
    Browse the repository at this point in the history
  132. [cling] Delete globals before JIT deletes the module:

    Fixes root-meta-execUnloading which shows
    ```==768591== Invalid read of size 8
    ==768591==    at 0x6EFB10E: llvm::ilist_node_base<false>::getNext() const (ilist_node_base.h:29)
    ==768591==    by 0x6FBF119: llvm::ilist_node_impl<llvm::ilist_detail::node_options<llvm::Function, false, false, void> >::getNext() (ilist_node.h:66)
    ==768591==    by 0x6FBED48: llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Function, false, false, void>, false, false>::operator++() (ilist_iterator.h:157)
    ==768591==    by 0x6FBEA20: llvm::simple_ilist<llvm::Function>::begin() (simple_ilist.h:117)
    ==768591==    by 0x6FBE40F: llvm::Module::begin() (Module.h:622)
    ==768591==    by 0x6FBE475: llvm::Module::functions() (Module.h:634)
    ==768591==    by 0x6FBE22F: cling::TransactionUnloader::unloadModule(llvm::Module*) (TransactionUnloader.cpp:175)
    ==768591==    by 0x6FBDF83: cling::TransactionUnloader::RevertTransaction(cling::Transaction*) (TransactionUnloader.cpp:126)
    ==768591==    by 0x6F90CD0: cling::Interpreter::unload(cling::Transaction&) (Interpreter.cpp:1553)
    ==768591==    by 0x6F90E25: cling::Interpreter::unload(unsigned int) (Interpreter.cpp:1574)
    ==768591==    by 0x721A9F2: cling::MetaSema::actOnUndoCommand(unsigned int) (MetaSema.cpp:186)
    ```
    ...
    ```
    ==768591==  Address 0x144b0ce0 is 32 bytes inside a block of size 800 free'd
    ==768591==    at 0x484399B: operator delete(void*, unsigned long) (vg_replace_malloc.c:935)
    ==768591==    by 0x6FBC7CA: std::default_delete<llvm::Module>::operator()(llvm::Module*) const (unique_ptr.h:95)
    ==768591==    by 0x6FBC82D: std::__uniq_ptr_impl<llvm::Module, std::default_delete<llvm::Module> >::reset(llvm::Module*) (unique_ptr.h:203)
    ==768591==    by 0x6FBC87E: std::unique_ptr<llvm::Module, std::default_delete<llvm::Module> >::reset(llvm::Module*) (unique_ptr.h:501)
    ==768591==    by 0x6FBC04E: std::unique_ptr<llvm::Module, std::default_delete<llvm::Module> >::operator=(decltype(nullptr)) (unique_ptr.h:434)
    ==768591==    by 0x70E60E7: llvm::orc::ThreadSafeModule::~ThreadSafeModule() (ThreadSafeModule.h:116)
    ==768591==    by 0x936EC79: llvm::orc::IRMaterializationUnit::~IRMaterializationUnit() (Layer.h:31)
    ==768591==    by 0x93707F5: llvm::orc::BasicIRLayerMaterializationUnit::~BasicIRLayerMaterializationUnit() (Layer.h:121)
    ==768591==    by 0x9370811: llvm::orc::BasicIRLayerMaterializationUnit::~BasicIRLayerMaterializationUnit() (Layer.h:121)
    ==768591==    by 0x6E91B45: std::default_delete<llvm::orc::MaterializationUnit>::operator()(llvm::orc::MaterializationUnit*) const (unique_ptr.h:95)
    ==768591==    by 0x6E8F9A3: std::unique_ptr<llvm::orc::MaterializationUnit, std::default_delete<llvm::orc::MaterializationUnit> >::~unique_ptr() (unique_ptr.h:396)
    ==768591==    by 0x935D3C3: llvm::orc::JITDylib::UnmaterializedInfo::~UnmaterializedInfo() (Core.h:1062)
    ==768591==    by 0x935D3DE: void std::_Destroy<llvm::orc::JITDylib::UnmaterializedInfo>(llvm::orc::JITDylib::UnmaterializedInfo*) (stl_construct.h:151)
    ==768591==    by 0x935D26B: void std::allocator_traits<std::allocator<void> >::destroy<llvm::orc::JITDylib::UnmaterializedInfo>(std::allocator<void>&, llvm::orc::JITDylib::UnmaterializedInfo*) (alloc_traits.h:648)
    ==768591==    by 0x935CBA0: std::_Sp_counted_ptr_inplace<llvm::orc::JITDylib::UnmaterializedInfo, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_M_dispose() (shared_ptr_base.h:613)
    ==768591==    by 0x6C39FCE: std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() (shared_ptr_base.h:346)
    ==768591==    by 0x6C3CB36: std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() (shared_ptr_base.h:1071)
    ==768591==    by 0x6E98CED: std::__shared_ptr<llvm::orc::JITDylib::UnmaterializedInfo, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() (shared_ptr_base.h:1524)
    ==768591==    by 0x6E98D09: std::shared_ptr<llvm::orc::JITDylib::UnmaterializedInfo>::~shared_ptr() (shared_ptr.h:175)
    ==768591==    by 0x932D614: llvm::DenseMapBase<llvm::DenseMap<llvm::orc::SymbolStringPtr, std::shared_ptr<llvm::orc::JITDylib::UnmaterializedInfo>, llvm::DenseMapInfo<llvm::orc::SymbolStringPtr>, llvm::detail::DenseMapPair<llvm::orc::SymbolStringPtr, std::shared_ptr<llvm::orc::JITDylib::UnmaterializedInfo> > >, llvm::orc::SymbolStringPtr, std::shared_ptr<llvm::orc::JITDylib::UnmaterializedInfo>, llvm::DenseMapInfo<llvm::orc::SymbolStringPtr>, llvm::detail::DenseMapPair<llvm::orc::SymbolStringPtr, std::shared_ptr<llvm::orc::JITDylib::UnmaterializedInfo> > >::erase(llvm::orc::SymbolStringPtr const&) (DenseMap.h:307)
    ==768591==    by 0x931028D: llvm::orc::JITDylib::removeTracker(llvm::orc::ResourceTracker&) (Core.cpp:1510)
    ==768591==    by 0x9315060: llvm::orc::ExecutionSession::removeResourceTracker(llvm::orc::ResourceTracker&)::{lambda()#1}::operator()() const (Core.cpp:2155)
    ==768591==    by 0x93150D0: decltype(auto) llvm::orc::ExecutionSession::runSessionLocked<llvm::orc::ExecutionSession::removeResourceTracker(llvm::orc::ResourceTracker&)::{lambda()#1}>(llvm::orc::ExecutionSession::removeResourceTracker(llvm::orc::ResourceTracker&)::{lambda()#1}&&) (Core.h:1326)
    ==768591==    by 0x9315272: llvm::orc::ExecutionSession::removeResourceTracker(llvm::orc::ResourceTracker&) (Core.cpp:2152)
    ==768591==    by 0x93060FD: llvm::orc::ResourceTracker::remove() (Core.cpp:53)
    ==768591==    by 0x70F1D58: cling::IncrementalJIT::removeModule(cling::Transaction const&) (IncrementalJIT.cpp:151)
    ==768591==    by 0x6FBE6CF: cling::IncrementalExecutor::unloadModule(cling::Transaction const&) const (IncrementalExecutor.h:180)
    ==768591==    by 0x6FBDE5B: cling::TransactionUnloader::RevertTransaction(cling::Transaction*) (TransactionUnloader.cpp:119)
    ==768591==    by 0x6F90CD0: cling::Interpreter::unload(cling::Transaction&) (Interpreter.cpp:1553)
    ==768591==    by 0x6F90E25: cling::Interpreter::unload(unsigned int) (Interpreter.cpp:1574)
    ==768591==    by 0x721A9F2: cling::MetaSema::actOnUndoCommand(unsigned int) (MetaSema.cpp:186)
    ```
    Axel-Naumann authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    728c2e1 View commit details
    Browse the repository at this point in the history
  133. D129175: [ORC] Fix weak hidden symbols failure on PPC with runtimedyld

    Original commit message:"
    
    [ORC] Fix weak hidden symbols failure on PPC with runtimedyld
    
    Fix "JIT session error: Symbols not found: [ DW.ref.__gxx_personality_v0 ] error" which happens when trying to use exceptions on ppc linux. To do this, it expands AutoClaimSymbols option in RTDyldObjectLinkingLayer to also claim weak symbols before they are tried to be resovled. In ppc linux, DW.ref symbols is emitted as weak hidden symbols in the later stage of MC pipeline. This means when using IRLayer (i.e. LLJIT), IRLayer will not claim responsibility for such symbols and RuntimeDyld will skip defining this symbol even though it couldn't resolve corresponding external symbol.
    
    Reviewed By: sgraenitz
    
    Differential Revision: https://reviews.llvm.org/D129175
    "
    
    This patch fixes the same issue for ROOT on ppc64le.
    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    8640238 View commit details
    Browse the repository at this point in the history
  134. Configuration menu
    Copy the full SHA
    57399b6 View commit details
    Browse the repository at this point in the history
  135. Backport D138264: [COFF] Improve JIT support of weak symbols.

    Original commit message: "
    Teach RuntimeDyld to handle COFF weak references and to consider comdat symbols as weak.
    
    Patch by Lang Hames and Sunho Kim!
    "
    
    https://reviews.llvm.org/D138264
    vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    8bd8fb1 View commit details
    Browse the repository at this point in the history
  136. Configuration menu
    Copy the full SHA
    a886646 View commit details
    Browse the repository at this point in the history
  137. [cling] Mark __dso_handle a "far" pointer:

    The relocation needs to allow for long offsets, as for the JIT, __dso_handle
    might be outside the shared library. Fixes
    ```
    cling JIT session error: In graph cling-module-10-jitted-objectbuffer, section __TEXT,__StaticInit: relocation target "___dso_handle" at address 0x7fe1ee5052e0 is out of range of Delta32 fixup at 0x108c410bd (___cxx_global_var_initcling_module_10_, 0x108c41090 + 0x2d)
    [runStaticInitializersOnce]: Failed to materialize symbols: { (main, { $.cling-module-10.__inits.0, __ZN12IncidentTypeL2m1E, __ZN6MarkerD2Ev, __ZN6MarkerD1Ev, ___cxx_global_var_initcling_module_10_.1, __GLOBAL__sub_I_cling_module_10, __ZN6MarkerC2EPKc, ___cxx_global_var_initcling_module_10_.3, __ZN12IncidentTypeL2m3E, __ZN6MarkerC1EPKc, __ZN12IncidentTypeL2m2E, ____orc_init_func.cling-module-10, ___cxx_global_var_initcling_module_10_ }) }
    ```
    as seen no RISC-V and macOS, i.e. with the JITLinker.
    hahnjo authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    e9d264e View commit details
    Browse the repository at this point in the history
  138. [cling] Make IncrementalExecutor::replaceSymbol() take IR names:

    Previously, one needed to pass linker-mangled names, which exposes details that
    clients of IncrementalExecutor should not have to deal with. Instead, use the IR
    name and do the linker-mangling in IncrementalJIT::addOrReplaceDefinition().
    
    This fixes the lack of static destruction on macOS, visible e.g. in the test
    failure of roottest/cling/staticinit/ROOT-7775.
    Axel-Naumann authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    cd4e143 View commit details
    Browse the repository at this point in the history
  139. [rootcling] State which module a header already belongs to:

    This helps with debugging why a certain header does not end up in a
    module that is currently generated.
    Axel-Naumann authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    8feb2f4 View commit details
    Browse the repository at this point in the history
  140. [cmake,thread,core] Move ThreadLocalStorage.h to foundation/:

    It is used by core/base and causes laying violations with modules, see
    module ROOT_Foundation_C which needs to contain ThreadLocalStorage.h.
    Axel-Naumann authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    1aa5500 View commit details
    Browse the repository at this point in the history
  141. [cling] Reintroduce custom memory manager

    This is still required for proper exception handling support. See
    commits 3f74182 and a7b0b3e by Philippe for details on the
    problem and the original code, which I was able to significantly
    simplify with the new JIT infrastructure.
    
    For the moment, this disables JITLink even on platforms that had it
    active by default (notably macOS). This will be reintroduced at a
    later point, which will require a memory manager implementation for
    the JITLink interface.
    hahnjo authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    0813a83 View commit details
    Browse the repository at this point in the history
  142. [cling] Disable release of code and data sections

    This is required until CallFunc is informed about unloading, and can
    re-generate the wrapper (if the decl is still available).
    hahnjo authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    dc607f1 View commit details
    Browse the repository at this point in the history
  143. [clang] Relax assertion on generating destructor call

    If the Decl pointers are not identical, declaresSameEntity will check
    the canonical Decls. This fixes the df021_createTGraph tutorial on
    CentOS 8.
    
    Upstream discussion in https://reviews.llvm.org/D137787
    hahnjo authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    ffe8679 View commit details
    Browse the repository at this point in the history
  144. Disable ASan check for initialization order

    It finds a false positive in llvm::DataLayout::reset accessing
    DefaultAlignments while loading the Net library. At this point,
    Cling and LLVM have definitely been initialized. This is a known
    limitation of the order check, which is why it was disabled by
    default. Remove our config to enable it for now to allow checking
    the LLVM upgrade with AddressSanitizer instrumentation.
    hahnjo authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    0907382 View commit details
    Browse the repository at this point in the history
  145. [cmake] Prevent Clang from finding CUDA

    This is only used to determine the architecture for OpenMP offloading,
    which we are not interested in.
    hahnjo authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    ff25aa0 View commit details
    Browse the repository at this point in the history
  146. Configuration menu
    Copy the full SHA
    182424b View commit details
    Browse the repository at this point in the history
  147. Configuration menu
    Copy the full SHA
    8286508 View commit details
    Browse the repository at this point in the history
  148. [TCling] Do not resolve weak or GCC/libstdc++ versioned symbols:

    As https://johannst.github.io/notes/development/symbolver.html points out,
    "@@" just means "default version". We want to skip any versioned GCC/glibc/
    libstdc++ symbol. Significantly reduces appetite for searching symbols.
    
    Then also skip wek symbols: even if they are unresolved we will happily
    not have them if they have not been loaded so far. Typical case is
    `__gmon_start__`.
    Axel-Naumann authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    1fdf170 View commit details
    Browse the repository at this point in the history
  149. Configuration menu
    Copy the full SHA
    8c8f97d View commit details
    Browse the repository at this point in the history
  150. [cling] Track (and unload) symbols from dylibs:

    When creating orec-Symbols for dylib symbols, reloading the
    dylib might mean a change in symbol (address). So unloading a
    dylib means we need to unload the orc-Symbol.
    
    This is implemented through resource-tracking the symbols as
    provided by DynamicLibrarySearchGenerator. Actually, as
    DynamicLibrarySearchGenerator does not support resource tracking,
    it is implemented in a near-copy of DynamicLibrarySearchGenerator,
    RTDynamicLibrarySearchGenerator, which uses the transaction of the
    most recent module for the ResourceTracker.
    Axel-Naumann authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    cbf04fb View commit details
    Browse the repository at this point in the history
  151. Configuration menu
    Copy the full SHA
    5b67d38 View commit details
    Browse the repository at this point in the history
  152. Configuration menu
    Copy the full SHA
    41c6af5 View commit details
    Browse the repository at this point in the history
  153. [cling] Fix bug in handling EXTRA_CLING_ARGS:

    The splitting code requires the full string to be null-terminated.
    Before, random bytes were attached to the last option.
    Axel-Naumann authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    587f7eb View commit details
    Browse the repository at this point in the history
  154. [clang] Reinstate also decls with internal linkage as deferred:

    on macOS11, stressInterpreter fails with not re-emitting _ZL6strstrUa9enable_ifILb1EEPKcS0_.
    It has internal linkage: originally deferred, it needs a chance to be re-emitted.
    Simplify this to include anything that was deferred and is either weak-for-linker or
    internal, to hopefully match all cases.
    Axel-Naumann authored and vgvassilev committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    20ee9be View commit details
    Browse the repository at this point in the history