This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][MemRef] Only allow fold of cast for the pointer operand, not the value
ClosedPublic

Authored by wsmoses on Jun 7 2021, 10:46 AM.

Details

Summary

Currently canonicalizations of a store and a cast try to fold all casts into the store.

In the case where the operand being stored is itself a cast, this is illegal as the type of the value being stored
will change. This PR fixes this by not checking the value for folding with a cast.

Depends on https://reviews.llvm.org/D103828

Diff Detail

Event Timeline

wsmoses created this revision.Jun 7 2021, 10:46 AM
wsmoses requested review of this revision.Jun 7 2021, 10:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 7 2021, 10:46 AM
mehdi_amini accepted this revision.Jun 7 2021, 11:08 AM
mehdi_amini added inline comments.
mlir/lib/Dialect/Affine/IR/AffineOps.cpp
948–950

Could also use make_filter_range instead:

for (OpOperand &operand : make_filter_range(op->getOpOperands(),
                    [] (OpOperand &operand) { return operand.get() != ignore; })) {
This revision is now accepted and ready to land.Jun 7 2021, 11:08 AM
This revision was landed with ongoing or failed builds.Jun 8 2021, 8:43 AM
This revision was automatically updated to reflect the committed changes.