[Mlir-commits] [mlir] [mlir][emitc] Relax `hasSideEffect` rules for Var/Member (PR #145011)
Gil Rapaport
llvmlistbot at llvm.org
Wed Jul 30 04:44:04 PDT 2025
aniragil wrote:
+1 on the motivation for this patch, which is IIUC to enable more expression merging.
A few questions:
1. While `load` from the stack should be free from out-of-bounds/invalid-address exceptions, I'm not sure about `member` (consider `(*(wrong_struct*)pointer_to_int).field_out_of_bounds`).
2. We use the side effects interface for enforcing memory access semantics w.r.t scheduling, e.g. in the program
```C
int f(int k) {
int a, b;
a = g(k);
b = h(a);
a = i(k);
return a + b;
}
```
it would be illegal to move the first load from `a` beyond the second store to `a`. The side effects is the MLIR modelling for those semantics. To prove that expressions could be merged requires proving first that one of them can be moved next to the other without violating side effect order (e.g. read after write).
https://github.com/llvm/llvm-project/pull/145011
More information about the Mlir-commits
mailing list