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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Oct 24 06:20:51 PDT 2023


Author: Christian Ulmann
Date: 2023-10-24T15:20:46+02:00
New Revision: cdaaa4d7fb26e3790ef022e3501820d4ba0f7728

URL: https://github.com/llvm/llvm-project/commit/cdaaa4d7fb26e3790ef022e3501820d4ba0f7728
DIFF: https://github.com/llvm/llvm-project/commit/cdaaa4d7fb26e3790ef022e3501820d4ba0f7728.diff

LOG: [MLIR][CFGToSCF] Fix exit latch location preservation (#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.

Added: 
    

Modified: 
    mlir/lib/Transforms/Utils/CFGToSCF.cpp

Removed: 
    


################################################################################
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