This is an archive of the discontinued LLVM Phabricator instance.

[WIP] Only insert memref_cast when needed during canonicalization.
AbandonedPublic

Authored by poechsel on Apr 8 2020, 6:51 AM.

Details

Reviewers
bondhugula
ftynse

Diff Detail

Event Timeline

poechsel created this revision.Apr 8 2020, 6:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 8 2020, 6:51 AM

Please include a brief commit summary. I only did a superficial review. Could you please include test cases?

mlir/lib/Dialect/StandardOps/IR/Ops.cpp
312

Doc comment with ///

313

Typo

322

More compact to use:

for (auto *userOp : oldOp->getUsers())

329

Likewise.

335

You could use replaceOpWithNewOp(oldOp, oldValue.getLoc(), ...)

bondhugula requested changes to this revision.Apr 8 2020, 7:18 AM
This revision now requires changes to proceed.Apr 8 2020, 7:18 AM
ftynse added a subscriber: ftynse.Apr 8 2020, 8:55 AM
ftynse added inline comments.
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
311

MLIR/LLVM prefer static to anonymous namespaces for functions

320

Either auto * or Operation *.

330

I'm not certain setType is okay inside a rewrite pattern. Can you find another way?

335

Nit: you don't need oldValue.getLoc(), the location will be extracted from oldOp.

rriddle added inline comments.Apr 8 2020, 10:53 AM
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
330

Should be fine if you wrap this loop in: rewriter.startRootUpdate()/rewriter.finalizeRootUpdate()

mehdi_amini added inline comments.Apr 8 2020, 8:39 PM
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
322

Operation * instead of auto please. In general please avoid auto where is does not improve readability / when the type isn't obvious from the context.

poechsel retitled this revision from Only insert memref_cast when needed during canonicalization. to [WIP] Only insert memref_cast when needed during canonicalization..Apr 9 2020, 5:59 AM
poechsel abandoned this revision.Apr 14 2020, 6:59 AM

I prefer to abandon this revision as I believe the way I'm doing things is the wrong way to do them:

  • This change is already breaking with some recent diffs of LLVM.
  • I really dislike having to add a "blacklist" instead of a whitelist.
  • I believe a new canonicalisation pattern would be more suited (ie less invasive).