[flang-commits] [flang] [flang] Add comdats to functions with linkonce linkage (PR #66516)

David Truby via flang-commits flang-commits at lists.llvm.org
Fri Sep 15 10:53:39 PDT 2023


================
@@ -3861,6 +3862,14 @@ class FIRToLLVMLowering
                                                std::move(pattern)))) {
       signalPassFailure();
     }
+
+    // Run pass to add comdats to functions that have weak linkage on relevant platforms
+    if (fir::getTargetTriple(mod).supportsCOMDAT()) {
----------------
DavidTruby wrote:

I did it here mostly because conceptually it's the place in the pipeline that it needs to happen; Another pass pipeline is actually run inside this pass just above this (`mlir::OpPassManager mathConvertionPM("builtin.module");`) so I thought it might not be that odd to do. 
I guess I could add it around here somewhere instead to use the same original PM, but do we have enough info to get the target triple info there? https://github.com/llvm/llvm-project/blob/32db121b29f78e4c41116b2a8f1c730f9522b202/flang/include/flang/Tools/CLOptions.inc#L161

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


More information about the flang-commits mailing list