[Mlir-commits] [mlir] Update MLIR to support nusw and nuw in GEP. (PR #137272)

Tobias Gysi llvmlistbot at llvm.org
Thu Apr 24 23:19:38 PDT 2025


================
@@ -1984,8 +1984,9 @@ LogicalResult ModuleImport::convertInstruction(llvm::Instruction *inst) {
     }
 
     Type type = convertType(inst->getType());
-    auto gepOp = builder.create<GEPOp>(loc, type, sourceElementType, *basePtr,
-                                       indices, gepInst->isInBounds());
+    auto gepOp = builder.create<GEPOp>(
+        loc, type, sourceElementType, *basePtr, indices,
+        gepInst->isInBounds() ? GEPNoWrapFlags::inbounds : GEPNoWrapFlags());
----------------
gysit wrote:

Can you import all the no wrap flags here and add a test to ensure the import works?

A test could be added here:
`llvm-project/mlir/test/Target/LLVMIR/Import/instructions.ll` or possibly even in a separate file.

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


More information about the Mlir-commits mailing list