[PATCH] D78447: [mlir][SCCP] Add support for propagating constants in the presence of region based control flow.

Uday Bondhugula via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 19 12:49:39 PDT 2020


bondhugula added a comment.

It's fantastic to have the same conditional constant propagation work for higher-order control flow ops and across nested regions! I think the revision title should be updated to better reflect that. "Region-based control flow" doesn't immediately imply that this works across nested regions / in and out of regions and not for just intra-region.



================
Comment at: mlir/include/mlir/Interfaces/ControlFlowInterfaces.h:94-99
+struct ReturnLike : public TraitBase<ConcreteType, ReturnLike> {
+  static LogicalResult verifyTrait(Operation *op) {
+    static_assert(ConcreteType::template hasTrait<IsTerminator>(),
+                  "expected operation to be a terminator");
+    static_assert(ConcreteType::template hasTrait<ZeroSuccessor>(),
+                  "expected operation to have zero successors");
----------------
`ReturnLike` trait ops should also produce zero results I believe - but its results are probably harmless / have no meaning since blocks with ReturnLike terminators won't properly dominate anything and so those results would be unused anyway. We aren't doing a zero result trait check on IsTerminator as well, but they are I guess allowed to have results (a way to send values to all successors for say branch like operations).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78447/new/

https://reviews.llvm.org/D78447





More information about the llvm-commits mailing list