[Mlir-commits] [mlir] [mlir] Add loop bounds normalization pass (PR #93781)

Jorn Tuyls llvmlistbot at llvm.org
Thu May 30 05:59:29 PDT 2024


================
@@ -245,8 +245,6 @@ void Operation::setOperands(ValueRange operands) {
 /// than the range pointed to by 'start'+'length'.
 void Operation::setOperands(unsigned start, unsigned length,
                             ValueRange operands) {
-  assert((start + length) <= getNumOperands() &&
-         "invalid operand range specified");
----------------
jtuyls wrote:

This removal is needed in the `setLowerBound/setUpperBound/setStep` functions of `scf.forall` as the number of operands can become larger: https://github.com/llvm/llvm-project/pull/93781/files#diff-4abb71b8e3632ea96a9ab4f1a2eb309b0065301dda5697bb493b6a572b9aee2aR1395.

`Operation::setOperands` actually just calls `OperandStorage::setOperands` (https://github.com/llvm/llvm-project/pull/93781/files#diff-4abb71b8e3632ea96a9ab4f1a2eb309b0065301dda5697bb493b6a572b9aee2aR1395) and that method doesn't have this limitation checked for by this assert and also doesn't have this assert: https://github.com/llvm/llvm-project/blob/806ed2625e9569bdb55a13a2b1f9c3e71293fda6/mlir/lib/IR/OperationSupport.cpp#L268.

As the underlying function being called doesn't have this limitation, I think it's safe to remove the assert here.

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


More information about the Mlir-commits mailing list