[all-commits] [llvm/llvm-project] 1e661e: [MLIR] Temporary workaround for calling the LLD EL...

Alexandre Ganea via All-commits all-commits at lists.llvm.org
Tue Feb 8 16:12:30 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1e661e583d8406d5fce5269e803b287987332831
      https://github.com/llvm/llvm-project/commit/1e661e583d8406d5fce5269e803b287987332831
  Author: Alexandre Ganea <alexandre.ganea at legionlabs.com>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M lld/Common/CommonLinkerContext.cpp
    M lld/include/lld/Common/Driver.h
    M mlir/lib/Dialect/GPU/Transforms/SerializeToHsaco.cpp

  Log Message:
  -----------
  [MLIR] Temporary workaround for calling the LLD ELF driver as-a-lib

This fixes the situation described in https://github.com/llvm/llvm-project/issues/53475 with a repro exposed by https://github.com/ROCmSoftwarePlatform/D108850-lld-bug-reproduction

This is purposely just a workaround to unblock users. This could be transplanted to the release/14.x branch if need be. A proper fix will later be provided in https://reviews.llvm.org/D119049.

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


  Commit: bb8be26a7ec36d32c605a5a15b92b5614453391f
      https://github.com/llvm/llvm-project/commit/bb8be26a7ec36d32c605a5a15b92b5614453391f
  Author: Alexandre Ganea <alexandre.ganea at legionlabs.com>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    A lld/test/ELF/amdgpu-duplicate-sym.s
    M lld/tools/lld/lld.cpp

  Log Message:
  -----------
  [LLD] Fix issue in HIP due to unspecified order of evaluation of the function object

This fixes the issue raised in https://reviews.llvm.org/D108850#3303452

Before C++17, the function object is evaluated in a unspecified order. In the following example: https://godbolt.org/z/8ao4vdsr7 the function object is either evaluated before or after the arguments, depending on the compiler. With MSVC and /std:c++14 the function object is evaluated after the arguments; with clang and gcc, it is evaluated before. With C++17, the function object is guaranteed to be evaluated before the arguments, see: https://riptutorial.com/cplusplus/example/19369/evaluation-order-of-function-arguments

In our case, the issue was that the `args` conversion to `ArrayRef` was evaluated before the lambda call `link`, which internally was calling `parseFlavor()`, which in turned modified `args`. We ended with an `ArrayRef` argument that reflected the previous contents of `args`.

Add coverage for `-flavor` which we didn't have before.

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


Compare: https://github.com/llvm/llvm-project/compare/9b81d2fae8c0...bb8be26a7ec3


More information about the All-commits mailing list