[Mlir-commits] [mlir] [mlir][Interfaces] Add `hasUnknownEffects` helper function (PR #154523)
Mehdi Amini
llvmlistbot at llvm.org
Wed Aug 20 05:50:33 PDT 2025
================
@@ -383,33 +383,47 @@ struct Write : public Effect::Base<Write> {};
// SideEffect Utilities
//===----------------------------------------------------------------------===//
-/// Returns true if `op` has only an effect of type `EffectTy`.
+/// Returns "true" if `op` has only an effect of type `EffectTy`. Returns
+/// "false" if `op` has unknown effects or other/additional effects. Recursive
+/// effects are not taken into account.
template <typename EffectTy>
bool hasSingleEffect(Operation *op);
-/// Returns true if `op` has only an effect of type `EffectTy` (and of no other
-/// type) on `value`.
+/// Returns "true" if `op` has only an effect of type `EffectTy` on `value`.
+/// Returns "false" if `op` has unknown effects or other/additional effects.
+/// Recursive effects are not taken into account.
template <typename EffectTy>
bool hasSingleEffect(Operation *op, Value value);
-/// Returns true if `op` has only an effect of type `EffectTy` (and of no other
-/// type) on `value` of type `ValueTy`.
+/// Returns "true" if `op` has only an effect of type `EffectTy` on `value` of
+/// type `ValueTy`. Returns "false" if `op` has unknown effects or
+/// other/additional effects. Recursive effects are not taken into account.
template <typename ValueTy, typename EffectTy>
bool hasSingleEffect(Operation *op, ValueTy value);
-/// Returns true if `op` has an effect of type `EffectTy`.
+/// Returns "true" if `op` has an effect of type `EffectTy`. Returns "false" if
+/// `op` has unknown effects. Recursive effects are not taken into account.
template <typename... EffectTys>
bool hasEffect(Operation *op);
-/// Returns true if `op` has an effect of type `EffectTy` on `value`.
+/// Returns "true" if `op` has an effect of type `EffectTy` on `value`. Returns
+/// "false" if `op` has unknown effects. Recursive effects are not taken into
+/// account.
template <typename... EffectTys>
bool hasEffect(Operation *op, Value value);
----------------
joker-eph wrote:
```
template typename<T>
bool mightHaveEffect(Operation *op, Value value) {
return hasEffect(op, value) || hasUnknownEffects(op);
}
```
?
https://github.com/llvm/llvm-project/pull/154523
More information about the Mlir-commits
mailing list