[Mlir-commits] [mlir] [mlir][BytecodeReader] Fix FusedLoc bytecode builder (PR #99632)

Hideto Ueno llvmlistbot at llvm.org
Sun Jul 21 09:19:55 PDT 2024


================
@@ -148,3 +149,24 @@ TEST(Bytecode, OpWithoutProperties) {
   EXPECT_TRUE(OperationEquivalence::computeHash(op.get()) ==
               OperationEquivalence::computeHash(roundtripped));
 }
+
+TEST(Bytecode, FusedLocCrash) {
+  MLIRContext context;
+  OpBuilder builder(&context);
+  SmallVector<Location> locs;
+  FusedLoc fusedLoc = FusedLoc::get(&context, locs, {});
----------------
uenoku wrote:

Disallowing empty location looks reasonable but the issue itself is not specific to empty location. We should be able to get the same failure when fused loc has a single location that is not fused loc ([this](https://github.com/llvm/llvm-project/blob/af0f58cf14329f5e0fe56fed7c9eb4cd3107a1ce/mlir/lib/IR/Location.cpp#L119-L120) is the code) e.g:
```c++
FileLineColLoc loc = ...;
FusedLoc fusedLoc = FusedLoc::get(&context, {loc}, {}) 
```


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


More information about the Mlir-commits mailing list