[Mlir-commits] [mlir] [mlir][memref] Add static_sizes attribute to memref.view (PR #183795)
Mehdi Amini
llvmlistbot at llvm.org
Sat Feb 28 03:59:57 PST 2026
joker-eph wrote:
> Can you explain why you say that? If we can verify OOB in compilation time, why would we want to leave it for runtime?
Because undefined behavior cannot be checked at compile time, because you don't know if the operation will be executed at runtime. It is a valid program to have such "impossible to execute" operations in unreachable code.
If you have operations that are purely static and don't have any runtime lowering, then having the values as attributes can be valuable (predictable lowering, simplified code, correctness by construction), but if we have operation that have dynamic operands, then it's not clear to me when are we benefiting from an extra path with static operands.
You also have now to equivalent form in the code:
```
%a = constant 42
... = my.op %a
```
and:
```
... = my.op 42
```
But, with your verifier, folding the first to the second isn't always possible (so the two forms aren't equivalent anymore?).
https://github.com/llvm/llvm-project/pull/183795
More information about the Mlir-commits
mailing list