[Mlir-commits] [mlir] [MLIR][CFGToSCF] Fix exit latch location preservation (PR #70032)

Christian Ulmann llvmlistbot at llvm.org
Tue Oct 24 04:48:11 PDT 2023


https://github.com/Dinistro created https://github.com/llvm/llvm-project/pull/70032

This commit ensures that the CFG to SCF lifting does not accidentally drop locations of loop latches during the lifting.

Note that I didn't add a test as we do not seem to have any tests for location tracking in any of the similar passes.

>From 031bbfe0e64b2688719078556e408ef8dd4cab42 Mon Sep 17 00:00:00 2001
From: Christian Ulmann <christian.ulmann at nextsilicon.com>
Date: Tue, 24 Oct 2023 11:44:48 +0000
Subject: [PATCH] [MLIR][CFGToSCF] Fix exit latch location preservation

This commit ensures that the CFG to SCF lifting does not accidentally
drop locations of loop latches during the lifting.
---
 mlir/lib/Transforms/Utils/CFGToSCF.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mlir/lib/Transforms/Utils/CFGToSCF.cpp b/mlir/lib/Transforms/Utils/CFGToSCF.cpp
index def91a5593df410..f2998b4047e201e 100644
--- a/mlir/lib/Transforms/Utils/CFGToSCF.cpp
+++ b/mlir/lib/Transforms/Utils/CFGToSCF.cpp
@@ -601,7 +601,7 @@ static FailureOr<StructuredLoopProperties> createSingleExitingLatch(
   {
     auto builder = OpBuilder::atBlockBegin(latchBlock);
     interface.createConditionalBranch(
-        builder.getUnknownLoc(), builder, shouldRepeat, loopHeader,
+        loc, builder, shouldRepeat, loopHeader,
         latchBlock->getArguments().take_front(loopHeader->getNumArguments()),
         /*falseDest=*/exitBlock,
         /*falseArgs=*/{});



More information about the Mlir-commits mailing list