[llvm] [llvm][EmbedBitcodePass] Prevent modifying the module with ThinLTO (PR #139999)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 27 04:13:25 PDT 2025


nikic wrote:

Added support for running the fat LTO pipeline in opt in https://github.com/llvm/llvm-project/pull/146048, though this does not help reproducing this issue.

Here is a reduction:
```cpp
; RUN: clang -g -flto=thin -ffat-lto-objects < %s
template <void CloseFunction()>
struct ScopedResource {
  ~ScopedResource() { CloseFunction(); }
};
 
void CloseFile();
 
struct Client {
  void CreateInstance(ScopedResource<CloseFile>);
  Client();
};
 
struct ClientImpl {
  ClientImpl(ScopedResource<CloseFile>, int *);
};
 
int CreateInstance_task_runner;
void Client::CreateInstance(ScopedResource<CloseFile> conn_args) {
  ClientImpl(conn_args, &CreateInstance_task_runner);
}
```

https://github.com/llvm/llvm-project/pull/139999


More information about the llvm-commits mailing list