[Lldb-commits] [llvm] [mlir] [lldb] [mlir] Introduce replaceWithZeroTripCheck in LoopLikeOpInterface (PR #80331)
Jerry Wu via lldb-commits
lldb-commits at lists.llvm.org
Fri Feb 2 14:08:10 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
+ run and return the new loop inside the check. The loop body is moved
----------------
pzread wrote:
Sometimes it is easier to create a new loop because we need to rotate the loop (`while {}` -> `do {} while`); otherwise the condition ops will be run twice and might have unwanted side effect. See the implementation of while loop as a example: #80349
We can still rotate the loop without creating a new op, but that will involve many tricky block arguments/operands updates. So I think it might be easier to allow this method to return a new loop op.
https://github.com/llvm/llvm-project/pull/80331
More information about the lldb-commits
mailing list