[all-commits] [llvm/llvm-project] 5f476b: [flang] Add comdats to functions with linkonce lin...

David Truby via All-commits all-commits at lists.llvm.org
Tue Sep 19 07:00:19 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5f476b80e3d472f672f5f6a719eebe2c0aadf52c
  Author: David Truby <david at truby.dev>
  Date:   2023-09-19 (Tue, 19 Sep 2023)

  Changed paths:
    M flang/lib/Optimizer/CodeGen/CodeGen.cpp
    A flang/test/Fir/comdat.fir
    M flang/test/Intrinsics/math-codegen.fir

  Log Message:
  [flang] Add comdats to functions with linkonce linkage (#66516)

This fixes a bug where functions generated by the MLIR Math dialect, for
example ipowi, would fail to link with link.exe on Windows due to having
linkonce linkage but no associated comdat. Adding the comdat on ELF also
allows linkers to perform better garbage collection in the binary.

Simply adding comdats to all functions with this linkage type should
also cover future cases where linkonce or linkonce_odr functions might
be necessary.

More information about the All-commits mailing list