[flang-commits] [flang] [Flang] Use `LLVMConversionTarget` instead of `ConversionTarget`. (PR #169770)

via flang-commits flang-commits at lists.llvm.org
Wed Nov 26 23:58:23 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-codegen

Author: Ming Yan (NexMing)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/169770.diff


1 Files Affected:

- (modified) flang/lib/Optimizer/CodeGen/CodeGen.cpp (+2-2) 


``````````diff
diff --git a/flang/lib/Optimizer/CodeGen/CodeGen.cpp b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
index f96d45d3f6b66..2c56f12ac4f9d 100644
--- a/flang/lib/Optimizer/CodeGen/CodeGen.cpp
+++ b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
@@ -39,6 +39,7 @@
 #include "mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h"
 #include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h"
 #include "mlir/Conversion/IndexToLLVM/IndexToLLVM.h"
+#include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
 #include "mlir/Conversion/LLVMCommon/Pattern.h"
 #include "mlir/Conversion/MathToFuncs/MathToFuncs.h"
 #include "mlir/Conversion/MathToLLVM/MathToLLVM.h"
@@ -4314,8 +4315,7 @@ class FIRToLLVMLowering
     // handling of things like Box types.
     fir::populateOpenMPFIRToLLVMConversionPatterns(typeConverter, pattern);
 
-    mlir::ConversionTarget target{*context};
-    target.addLegalDialect<mlir::LLVM::LLVMDialect>();
+    mlir::LLVMConversionTarget target(*context);
     // The OpenMP dialect is legal for Operations without regions, for those
     // which contains regions it is legal if the region contains only the
     // LLVM dialect. Add OpenMP dialect as a legal dialect for conversion and

``````````

</details>


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


More information about the flang-commits mailing list