[Mlir-commits] [mlir] [MLIR][LLVM] Refactor globals insertion point in import (NFC) (PR #127490)
Tobias Gysi
llvmlistbot at llvm.org
Mon Feb 17 11:55:09 PST 2025
================
@@ -996,11 +1001,7 @@ LogicalResult ModuleImport::convertAlias(llvm::GlobalAlias *alias) {
LogicalResult ModuleImport::convertGlobal(llvm::GlobalVariable *globalVar) {
// Insert the global after the last one or at the start of the module.
- OpBuilder::InsertionGuard guard(builder);
- if (!globalInsertionOp)
- builder.setInsertionPointToStart(mlirModule.getBody());
- else
- builder.setInsertionPointAfter(globalInsertionOp);
+ OpBuilder::InsertionGuard guard = setGlobalInsertionPoint(globalInsertionOp);
----------------
gysit wrote:
I believe having just one `globalInsertionOp` makes sense. I even wonder why we introduced the insertions ops in the first place. It may also be possible to convert comdats/globals/aliases/functions etc in the desired order and insert them always at the end of the module. However, having one `globalInsertionOp` sounds like a good step forward.
https://github.com/llvm/llvm-project/pull/127490
More information about the Mlir-commits
mailing list