This is an archive of the discontinued LLVM Phabricator instance.

[llvm] Handle dso_local_equivalent in FunctionComparator
ClosedPublic

Authored by leonardchan on Sep 20 2022, 12:04 PM.

Details

Summary

This addresses https://github.com/llvm/llvm-project/issues/51066.

Prior to this, dso_local_equivalent would lead to an llvm_unreachable in a switch in the FunctionComparator. This adds a conservative case in that switch that just compares the underlying functions.

Diff Detail

Event Timeline

leonardchan created this revision.Sep 20 2022, 12:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 20 2022, 12:04 PM
leonardchan requested review of this revision.Sep 20 2022, 12:04 PM

@phosek feel free to add who you think is appropriate for reviewing this.

This is a conservative comparison of dso_local_equivalents where two are the same only if they point to the same underlying function. It could be argued that a dso_local_equivalent @func could be "the same" as just @func, but I think that can be argued/implemented separately. This is mainly for addressing the crash in pr51066.

nikic added a subscriber: nikic.Sep 20 2022, 12:11 PM

Please drop the clang test and use update_test_checks.py for LLVM tests.

llvm/test/Transforms/MergeFunc/dso_local_equivalent_merged.ll
2

Based on your check lines, it doesn't look like the functions actually get merged? You probably need to add some dummy instructions to pass the instruction threshold, or use internal linkage.

leonardchan added inline comments.
llvm/test/Transforms/MergeFunc/dso_local_equivalent_merged.ll
2

Woops. Yeah you're right. Updating the tests.

phosek accepted this revision.Sep 20 2022, 2:17 PM

LGTM

This revision is now accepted and ready to land.Sep 20 2022, 2:17 PM

Will wait until EOD before committing this unless others have more comments.

This revision was landed with ongoing or failed builds.Sep 22 2022, 11:46 AM
This revision was automatically updated to reflect the committed changes.