forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang] Avoid generating duplicate symbol in comdat (llvm#114472)
In case where a fir.global might be duplicated in an inner module (gpu.module), the conversion pattern will be applied on the module and the gpu module version of the global and try to generate multiple comdat with the same symbol name. This is what we have in the implementation of CUDA Fortran. Just check for the presence of the `ComdatSelectorOp` before creating a new one.
- Loading branch information
1 parent
067ce5c
commit 466b58b
Showing
2 changed files
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// RUN: fir-opt %s --fir-to-llvm-ir="target=x86_64-unknown-linux-gnu" | FileCheck %s | ||
// RUN: fir-opt %s --fir-to-llvm-ir="target=x86_64-pc-windows-msvc" | FileCheck %s | ||
|
||
fir.global linkonce_odr @global_linkonce_odr constant : i32 { | ||
%0 = arith.constant 0 : i32 | ||
fir.has_value %0 : i32 | ||
} | ||
|
||
llvm.comdat @__llvm_comdat { | ||
llvm.comdat_selector @global_linkonce_odr any | ||
} | ||
|
||
// CHECK-LABEL: llvm.comdat @__llvm_comdat | ||
// CHECK: llvm.comdat_selector @global_linkonce_odr any |