This is an archive of the discontinued LLVM Phabricator instance.

[flang] Lower integer comparison operation
ClosedPublic

Authored by clementval on Feb 25 2022, 5:34 AM.

Details

Summary

This patch handles the lowering of comprison
operator between integers.
The comparison is lowered to a arith.cmpi operation.

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

Diff Detail

Event Timeline

clementval created this revision.Feb 25 2022, 5:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 25 2022, 5:34 AM
Herald added a subscriber: mehdi_amini. · View Herald Transcript
clementval requested review of this revision.Feb 25 2022, 5:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 25 2022, 5:34 AM
rovka accepted this revision.Feb 25 2022, 6:13 AM
rovka added a subscriber: rovka.

LGTM.

flang/lib/Lower/ConvertExpr.cpp
363

Nit: Why is this a template if it takes a CmpIPredicate? Can we use anything other than CmpIOp with a CmpIPredicate?

flang/test/Lower/integer-operations.f90
72

I don't mind more tests, but where these supposed to be in a different patch? :)

This revision is now accepted and ready to land.Feb 25 2022, 6:13 AM
clementval marked an inline comment as done.Feb 25 2022, 6:39 AM
clementval added inline comments.
flang/lib/Lower/ConvertExpr.cpp
363

Yes mlir::arith::CmpFOp and fir::CmpcOp operations will use that.

flang/test/Lower/integer-operations.f90
72

I don't mind sending them as a separate patch. They were bundled together in fir-dev so for simplicity.

PeteSteinfeld accepted this revision.Feb 25 2022, 8:41 AM

All builds and tests correctly and looks good.

schweitz accepted this revision.Feb 25 2022, 8:43 AM
This revision was automatically updated to reflect the committed changes.
clementval marked an inline comment as done.