[llvm] [mlir] [lldb] [mlir] Introduce replaceWithZeroTripCheck in LoopLikeOpInterface (PR #80331)

Matthias Springer via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 5 12:11:47 PST 2024


================
@@ -220,6 +220,31 @@ def LoopLikeOpInterface : OpInterface<"LoopLikeOpInterface"> {
       /*defaultImplementation=*/[{
         return ::mlir::failure();
       }]
+    >,
+    InterfaceMethod<[{
+        Add a zero-trip-check around the loop to check if the loop body is ever
----------------
matthias-springer wrote:

This makes sense, I did not think of side effects.

The lambda sounds like a good idea, but I'm not sure what exactly it should look like. (Should it return a `Block *` into which the loop is moved?) We can generalize later if needed.

I think it would also work for `scf.for`. The check condition is `lb < ub`.


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


More information about the llvm-commits mailing list