[Mlir-commits] [mlir] Enable LICM for ops with only read side effects in scf.for (PR #120302)

Arda Unal llvmlistbot at llvm.org
Thu Dec 19 17:19:42 PST 2024


================
@@ -306,6 +306,13 @@ bool mlir::wouldOpBeTriviallyDead(Operation *op) {
   return wouldOpBeTriviallyDeadImpl(op);
 }
 
+bool mlir::hasOnlyReadEffect(Operation *op) {
+  if (auto memEffects = dyn_cast<MemoryEffectOpInterface>(op)) {
+    return memEffects.onlyHasEffect<MemoryEffects::Read>();
+  }
+  return false;
----------------
ardaunal wrote:

It would return false. It is why check is done in combination with _isMemoryEffectFree_ [here](https://github.com/llvm/llvm-project/pull/120302/files#diff-a18ca7e24c6603fc6dbf7a1e8ea876c7cce7a9d44b7ed189720e1fd11467c645R183)

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


More information about the Mlir-commits mailing list