Clean up conditional logic of hasSingleEffect. NFC.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Interfaces/SideEffectInterfaces.cpp | ||
---|---|---|
99–110 | If we check early for effects.empty() and return false, do we even need to track hasSingleEffectOnVal through the loop? |
mlir/lib/Interfaces/SideEffectInterfaces.cpp | ||
---|---|---|
99–110 | We would still need to --- since you could have other effects that are not on value. This method needs to check if EffectTy is the only effect that this op has *on value*. In the logic you suggested, you'd return false even whenever there is an effect on a different value. If the desired semantics of the method had been to only restrict effects to only this value, then the above logic would implement it compactly. But that's not what is desired here. For eg., a common scenario is check whether an operation only has a "read" memory effect on a specific memref value which happens to be one or more of its operands. We aren't concerned about what other effects the op has on other value operands. |
If we check early for effects.empty() and return false, do we even need to track hasSingleEffectOnVal through the loop?