[Mlir-commits] [mlir] 33879aa - [mlir] Fixed GCC compile issues and linking problems using SHARED_LIBS.

Marcel Koester llvmlistbot at llvm.org
Mon Jun 15 06:47:10 PDT 2020


Author: Marcel Koester
Date: 2020-06-15T15:46:21+02:00
New Revision: 33879aa0bf0079f81223037c8e412411a7d919bc

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

LOG: [mlir] Fixed GCC compile issues and linking problems using SHARED_LIBS.

Differential Revision: https://reviews.llvm.org/D81839

Added: 
    

Modified: 
    mlir/lib/Transforms/BufferPlacement.cpp
    mlir/lib/Transforms/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Transforms/BufferPlacement.cpp b/mlir/lib/Transforms/BufferPlacement.cpp
index b1cda451fe7d..74c534701536 100644
--- a/mlir/lib/Transforms/BufferPlacement.cpp
+++ b/mlir/lib/Transforms/BufferPlacement.cpp
@@ -296,7 +296,9 @@ class BufferPlacement {
         if (!dominators.dominates(definingBlock, blockArg.getOwner())) {
           toProcess.emplace_back(blockArg, blockArg.getParentBlock());
           blockArgsToFree.insert(blockArg);
-        } else if (visitedBlockArgs.insert({blockArg, definingBlock}).second)
+        } else if (visitedBlockArgs
+                       .insert(std::make_tuple(blockArg, definingBlock))
+                       .second)
           toProcess.emplace_back(blockArg, definingBlock);
       }
     };
@@ -328,13 +330,12 @@ class BufferPlacement {
         // Get the terminator and the value that will be passed to our
         // argument.
         Operation *terminator = (*it)->getTerminator();
-        auto successorOperand =
-            cast<BranchOpInterface>(terminator)
-                .getMutableSuccessorOperands(it.getSuccessorIndex())
-                .getValue()
-                .slice(blockArg.getArgNumber(), 1);
-        Value sourceValue = ((OperandRange)successorOperand)[0];
-
+        auto branchInterface = cast<BranchOpInterface>(terminator);
+        // Convert the mutable operand range to an immutable range and query the
+        // associated source value.
+        Value sourceValue =
+            branchInterface.getSuccessorOperands(it.getSuccessorIndex())
+                .getValue()[blockArg.getArgNumber()];
         // Create a new alloc at the current location of the terminator.
         auto memRefType = sourceValue.getType().cast<MemRefType>();
         OpBuilder builder(terminator);
@@ -354,7 +355,10 @@ class BufferPlacement {
         auto alloc = builder.create<AllocOp>(terminator->getLoc(), memRefType,
                                              dynamicOperands);
         // Wire new alloc and successor operand.
-        successorOperand.assign(alloc);
+        branchInterface.getMutableSuccessorOperands(it.getSuccessorIndex())
+            .getValue()
+            .slice(blockArg.getArgNumber(), 1)
+            .assign(alloc);
         // Create a new copy operation that copies to contents of the old
         // allocation to the new one.
         builder.create<linalg::CopyOp>(terminator->getLoc(), sourceValue,

diff  --git a/mlir/lib/Transforms/CMakeLists.txt b/mlir/lib/Transforms/CMakeLists.txt
index de259f70023f..f391a2662ac4 100644
--- a/mlir/lib/Transforms/CMakeLists.txt
+++ b/mlir/lib/Transforms/CMakeLists.txt
@@ -30,6 +30,7 @@ add_mlir_library(MLIRTransforms
   LINK_LIBS PUBLIC
   MLIRAffineOps
   MLIRAnalysis
+  MLIRLinalgOps
   MLIRLoopLikeInterface
   MLIRSCF
   MLIRPass


        


More information about the Mlir-commits mailing list