This is an archive of the discontinued LLVM Phabricator instance.

[flang] Add type-specific runtime entries for Minloc/Maxloc.
ClosedPublic

Authored by vzakhari on Oct 10 2022, 11:43 AM.

Details

Summary

We used to have a big switch statement over the type categories and kinds
inside Minloc/Maxloc. After D133051 the switch grew bigger, and this
changed inlining decisions made by GCC (the build compiler). Some of the
simple methods stopped being inlined, and this caused slight performance
regression in Polyhedron/gas_dyn2. This change adds separate entries
for real/integer data types to let them be optimized separately.

Diff Detail

Event Timeline

vzakhari created this revision.Oct 10 2022, 11:43 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 10 2022, 11:43 AM
vzakhari requested review of this revision.Oct 10 2022, 11:43 AM
klausler added inline comments.Oct 10 2022, 2:03 PM
flang/runtime/extrema.cpp
171

The type code in the descriptor for x should be checked against CAT and KIND somewhere.

vzakhari added inline comments.Oct 10 2022, 3:06 PM
flang/runtime/extrema.cpp
171

Line 186 should be doing this.

klausler accepted this revision.Oct 10 2022, 4:39 PM
This revision is now accepted and ready to land.Oct 10 2022, 4:39 PM
peixin added a subscriber: peixin.Oct 10 2022, 11:39 PM
peixin added inline comments.
flang/runtime/extrema.cpp
159

Should this "switch" be removed and replaced with one assert?

217

It seems that buildbot fails since the following is missed.

#ifdef __SIZEOF_INT128__
vzakhari added inline comments.Oct 11 2022, 8:35 AM
flang/runtime/extrema.cpp
217

Thank you, @peixin! I will merge the fix shortly.