[PATCH] D77485: [MLIR] Handle in-place folding properly in greedy pattern rewrite driver
Uday Bondhugula via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 11 07:27:16 PDT 2020
bondhugula marked 6 inline comments as done.
bondhugula added inline comments.
================
Comment at: mlir/lib/Transforms/Utils/FoldUtils.cpp:78
+ function_ref<void(Operation *)> preReplaceAction, bool *inPlaceUpdate) {
+ if (inPlaceUpdate)
+ *inPlaceUpdate = false;
----------------
rriddle wrote:
> 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.
Hmm... that would be weird to have a part of its logic outside given inPlaceUpdate is an output parameter (and the assertion would still crash if they just sent in an uninitialized pointer).
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