[PATCH] D77485: [MLIR] Handle in-place folding properly in greedy pattern rewrite driver

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 11 02:06:40 PDT 2020


rriddle added inline comments.


================
Comment at: mlir/lib/Transforms/Utils/FoldUtils.cpp:78
+    function_ref<void(Operation *)> preReplaceAction, bool *inPlaceUpdate) {
+  if (inPlaceUpdate)
+    *inPlaceUpdate = false;
----------------
bondhugula wrote:
> rriddle wrote:
> > Can we just have this as a precondition? That avoids uninitialized variables being passed in.
> Sorry, I didn't get you. Did you mean making `inPlaceUpdate` a compulsory parameter and asserting `inPlaceUpdate` (in which case we can instead just pass by reference) or adding `assert(!*inPlaceUpdate && 'should be initialized to false');`? Thanks.
I meant the second one.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77485





More information about the llvm-commits mailing list