Page MenuHomePhabricator

[flang] Update the conversion code for fir.coordinate_of
ClosedPublic

Authored by awarzynski on Mar 31 2022, 3:49 AM.

Details

Summary

These are mostly small changes to make the code a bit clearer and more
consistent. Summary of changes:

  • add missing namespace qualifiers (that's the preference in Flang)
  • replace const member methods with static methods (to avoid passing the *this pointer unnecessarily)
  • rename currentObjTy (current object type) as cpnTy (component type) - the latter feels more fitting
  • remove redundant return failure(); calls ( return mlir::emitError gives the same result)
  • updated a few comments

Diff Detail

Event Timeline

awarzynski created this revision.Mar 31 2022, 3:49 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 31 2022, 3:49 AM
awarzynski requested review of this revision.Mar 31 2022, 3:49 AM

Can you fix the clang-format problems?

Is this an update from changes made while syncing back to fir-dev?

awarzynski updated this revision to Diff 419667.Apr 1 2022, 1:40 AM

Fix formatting

Can you fix the clang-format problems?

Sorry about that. I've tried debugging Arcanist, but to no avail. Annoyingly, it does work occasionally :/

Is this an update from changes made while syncing back to fir-dev?

Yes.

ekieri added a subscriber: ekieri.Apr 1 2022, 7:36 AM
ekieri added inline comments.
flang/lib/Optimizer/CodeGen/CodeGen.cpp
2304–2306

nit: You could limit the scope of sz by initialising it in the init slot of the loop together with i (as you do further down). Won't make much difference in this case, but for the good habit.

This revision is now accepted and ready to land.Apr 1 2022, 7:57 AM
awarzynski added inline comments.Apr 1 2022, 8:36 AM
flang/lib/Optimizer/CodeGen/CodeGen.cpp
2304–2306

Good point, thanks!

awarzynski updated this revision to Diff 419771.Apr 1 2022, 8:37 AM

Move the definition of sz

schweitz accepted this revision.Apr 1 2022, 9:54 AM

Thanks for upstreaming these, Andrzej.