[Mlir-commits] [mlir] [MLIR][LLVM] Refactor globals insertion point in import (NFC) (PR #127490)

Henrich Lauko llvmlistbot at llvm.org
Mon Feb 17 12:07:27 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);
----------------
xlauko wrote:

Except for an unexpected order in tests, everything seems to pass. I'll polish this further then. :)

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


More information about the Mlir-commits mailing list