[Mlir-commits] [mlir] [mlir] Fix integer overflow in ShapedType::getNumElements (PR #178395)

Stefan Weigl-Bosker llvmlistbot at llvm.org
Wed Jan 28 10:47:45 PST 2026


sweiglbosker wrote:

That was more a rhetorical question, but with this change you should leave getNumElements() as is (it should not do a checkedmul if it ignores the check anyway), and implement tryGetNumElements seperately. I was asking about moving the check to verifier because i think having an elementcount that doesnt overflow seems like a reasonable invariant. In other words, if we prevent such types from existing/being valid we never need to handle them.

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


More information about the Mlir-commits mailing list