[clang] [LinkerWrapper] Always pass `-flto` if the linker supports it (PR #102972)

Joel E. Denny via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 13 07:49:17 PDT 2024


jdenny-ornl wrote:

Seems like it does what it intends to do.  Thanks for working on it.

However, there's a side effect.  Now that -O1 gets passed along, sometimes it triggers an assert fail for AMD GPU:

```
ld.lld: /tmp/llvm/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp:151: virtual bool llvm::AMDGPUResourceUsageAnalysis::runOnModule(llvm::Module&): Assertion `MF && "function must have been generated already"' failed.
```

On my AMD GPU test system, I see new test fails.  They all use -O1 and fail that assert:

```
Failed Tests (4):
  libomptarget :: amdgcn-amd-amdhsa :: api/omp_dynamic_shared_memory_amdgpu.c
  libomptarget :: amdgcn-amd-amdhsa :: api/omp_dynamic_shared_memory_mixed_amdgpu.c
  libomptarget :: amdgcn-amd-amdhsa :: offloading/bug51781.c
  libomptarget :: amdgcn-amd-amdhsa :: offloading/bug51982.c
```

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


More information about the cfe-commits mailing list