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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Oct 24 04:49:17 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Christian Ulmann (Dinistro)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/70032.diff


1 Files Affected:

- (modified) mlir/lib/Transforms/Utils/CFGToSCF.cpp (+1-1) 


``````````diff
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=*/{});

``````````

</details>


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


More information about the Mlir-commits mailing list