[Mlir-commits] [mlir] [MLIR][Transforms] Update block arg locations during inlining (PR #106064)

Tobias Gysi llvmlistbot at llvm.org
Mon Aug 26 05:28:58 PDT 2024


================
@@ -25,22 +25,36 @@
 
 using namespace mlir;
 
-/// Remap locations from the inlined blocks with CallSiteLoc locations with the
-/// provided caller location.
+/// Remap all locations from the inlined blocks with CallSiteLoc locations with
+/// the provided caller location.
 static void
 remapInlinedLocations(iterator_range<Region::iterator> inlinedBlocks,
                       Location callerLoc) {
   DenseMap<Location, Location> mappedLocations;
-  auto remapOpLoc = [&](Operation *op) {
-    auto it = mappedLocations.find(op->getLoc());
+  auto remapLoc = [&](Location loc) {
+    auto it = mappedLocations.find(loc);
----------------
gysit wrote:

```suggestion
    auto [remapLoc, inserted] = mappedLocations.try_emplace(loc);
    if (inserted) {
    
    }
```
Can we try emplace directly to avoid the double search? 

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


More information about the Mlir-commits mailing list