[PATCH] D78397: [mlir][Transforms] Add pass to perform sparse conditional constant propagation

Uday Bondhugula via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 17 14:05:13 PDT 2020


bondhugula added a comment.

I think the test cases are missing one of the key scenarios where a control flow path / block isn't executed because the predicate is a constant but that is only known by detecting that the same constant propagates across the back edge as well as the other predecessor. And to know that the same constant propagates, you need to know that the aforementioned control flow path doesn't execute - sort of a catch22. An example (mixed basic blocks with some C for brevity).

  func @foo
  
  ^bb0:
    c1 = constant 1
    br ^bb1(c1)
  
  ^bb1(x1)
   if x1 < 20
     x2 = 1
     br ^bb1(x2)
   else 
     x3 = 50
     br ^bb1(x3)



================
Comment at: mlir/include/mlir/Transforms/Passes.td:282
+    optimistically propagates this throughout the IR. Any values proven to be
+    constant are replaced, and remove if possible.
+
----------------
remove -> removed


================
Comment at: mlir/test/Transforms/sccp.mlir:37
+
+/// Check that the PHI value goes to overdefined if the branch cannot detect
+/// when a specific successor is taken.
----------------
Nit: No phi's please! PHI values -> arguments ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78397





More information about the llvm-commits mailing list