This is an archive of the discontinued LLVM Phabricator instance.

[fir] Add fir.convert canonicalization patterns
ClosedPublic

Authored by clementval on Oct 11 2021, 5:04 AM.

Details

Summary

Add rewrite patterns for fir.convert op canonicalization.

This patch is part of the upstreaming effort from fir-dev branch.

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>

Diff Detail

Event Timeline

clementval created this revision.Oct 11 2021, 5:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 11 2021, 5:04 AM
Herald added a subscriber: mgorny. · View Herald Transcript
clementval requested review of this revision.Oct 11 2021, 5:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 11 2021, 5:04 AM
flang/include/flang/Optimizer/Transforms/RewritePatterns.td
30

Do these patterns check that there are no other users? Or is that not a problem here?

flang/test/Fir/convert-fold.fir
35

constant -> constant 10 ?

clementval marked 2 inline comments as done.Oct 11 2021, 7:11 AM
clementval added inline comments.
flang/include/flang/Optimizer/Transforms/RewritePatterns.td
30

These patterns are not removing the ops completely but rather simplifying some patterns. So the users get updated with the new value as well.

flang/test/Fir/convert-fold.fir
35

Good catch! Thanks.

This revision is now accepted and ready to land.Oct 11 2021, 7:11 AM
This revision was automatically updated to reflect the committed changes.
clementval marked 2 inline comments as done.