[flang][cuda] Make default.nonTbpDefinedIoTable compiler generated (#120686)

`default.nonTbpDefinedIoTable` is a special global defined for IO that
doesn't follow the mangling scheme and is then not handle correctly in
the `CompilerGeneratedNames` pass. Update how it is generated with
doGenerated so it can be handle without special handling.

Also do not generate comdat in gpu module as the current code is not
handling nested module correctly.
This commit is contained in:
Valentin Clement (バレンタイン クレメン)
2024-12-20 10:37:48 -08:00
committed by GitHub
parent 89cb528f07
commit 3e13acfbf4
5 changed files with 31 additions and 9 deletions

View File

@@ -2990,10 +2990,12 @@ struct GlobalOpConversion : public fir::FIROpConversion<fir::GlobalOp> {
g.setAlignment(*global.getAlignment());
auto module = global->getParentOfType<mlir::ModuleOp>();
auto gpuMod = global->getParentOfType<mlir::gpu::GPUModuleOp>();
// Add comdat if necessary
if (fir::getTargetTriple(module).supportsCOMDAT() &&
(linkage == mlir::LLVM::Linkage::Linkonce ||
linkage == mlir::LLVM::Linkage::LinkonceODR)) {
linkage == mlir::LLVM::Linkage::LinkonceODR) &&
!gpuMod) {
addComdat(g, rewriter, module);
}