[Mlir-commits] [mlir] 1367c5d - [mlir][mem2reg] Follow-up adjustments (NFC).
Tobias Gysi
llvmlistbot at llvm.org
Mon May 1 23:28:15 PDT 2023
Author: Théo Degioanni
Date: 2023-05-02T06:17:05Z
New Revision: 1367c5d6e096ad830c5ba37b1b3a5e2351ea28e9
URL: https://github.com/llvm/llvm-project/commit/1367c5d6e096ad830c5ba37b1b3a5e2351ea28e9
DIFF: https://github.com/llvm/llvm-project/commit/1367c5d6e096ad830c5ba37b1b3a5e2351ea28e9.diff
LOG: [mlir][mem2reg] Follow-up adjustments (NFC).
Ajustments to the MLIR mem2reg changes.
Reviewed By: gysit, kuhar
Differential Revision: https://reviews.llvm.org/D149431
Added:
Modified:
mlir/lib/Transforms/Mem2Reg.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Transforms/Mem2Reg.cpp b/mlir/lib/Transforms/Mem2Reg.cpp
index 5952de9ddb63b..5b5728385a160 100644
--- a/mlir/lib/Transforms/Mem2Reg.cpp
+++ b/mlir/lib/Transforms/Mem2Reg.cpp
@@ -178,14 +178,17 @@ SlotPromoter::SlotPromoter(MemorySlot slot,
PromotableAllocationOpInterface allocator,
OpBuilder &builder, DominanceInfo &dominance)
: slot(slot), allocator(allocator), builder(builder), dominance(dominance) {
- bool isResultOrNewBlockArgument = slot.ptr.getDefiningOp() == allocator;
- if (BlockArgument arg = slot.ptr.dyn_cast<BlockArgument>())
- isResultOrNewBlockArgument = isResultOrNewBlockArgument ||
- arg.getOwner()->getParentOp() == allocator;
- (void)isResultOrNewBlockArgument;
- assert(isResultOrNewBlockArgument &&
+#ifndef NDEBUG
+ auto isResultOrNewBlockArgument = [&]() {
+ if (BlockArgument arg = slot.ptr.dyn_cast<BlockArgument>())
+ return arg.getOwner()->getParentOp() == allocator;
+ return slot.ptr.getDefiningOp() == allocator;
+ };
+
+ assert(isResultOrNewBlockArgument() &&
"a slot must be a result of the allocator or an argument of the child "
"regions of the allocator");
+#endif // NDEBUG
}
Value SlotPromoter::getLazyDefaultValue() {
@@ -242,8 +245,7 @@ LogicalResult SlotPromoter::computeBlockingUses() {
// Then, register any new blocking uses for coming operations.
for (OpOperand *blockingUse : newBlockingUses) {
- assert(llvm::find(user->getResults(), blockingUse->get()) !=
- user->result_end());
+ assert(llvm::is_contained(user->getResults(), blockingUse->get()));
SmallPtrSetImpl<OpOperand *> &newUserBlockingUseSet =
userToBlockingUses.getOrInsertDefault(blockingUse->getOwner());
More information about the Mlir-commits
mailing list