[Mlir-commits] [mlir] [MLIR] Add single definition multiple regions for mem2reg (PR #89107)

Christian Ulmann llvmlistbot at llvm.org
Thu Apr 18 08:06:44 PDT 2024


================
@@ -278,8 +291,11 @@ LogicalResult MemorySlotPromotionAnalyzer::computeBlockingUses(
                                        dataLayout))
         return failure();
     } else if (auto promotable = dyn_cast<PromotableMemOpInterface>(user)) {
-      if (!promotable.canUsesBeRemoved(slot, blockingUses, newBlockingUses,
-                                       dataLayout))
+      if (promotable.canUsesBeRemoved(slot, blockingUses, newBlockingUses,
+                                      dataLayout))
+        promotable.storesTo(slot) ? singleDefining.setPointer(user),
+            totalStores++         : 0;
----------------
Dinistro wrote:

Don't use a ternary operations for such things. Just introduce an if instead.

Also, I suggest to keep the other `if` as is and add the `storesTo` check after this one.

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


More information about the Mlir-commits mailing list