This is an archive of the discontinued LLVM Phabricator instance.

[LTO] Add test coverage for previous dllimport fix
ClosedPublic

Authored by ormris on Apr 21 2023, 12:16 PM.

Details

Summary

Internal testing showed that the change made in commit 62fcfc5a needed more test coverage. Specifically, the imported function shouldn't be externally visible and the whole test needed to be run in regular LTO mode.

Diff Detail

Event Timeline

ormris created this revision.Apr 21 2023, 12:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 21 2023, 12:16 PM
ormris requested review of this revision.Apr 21 2023, 12:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 21 2023, 12:16 PM

The original patch (D55627) added test/LTO/Resolution/X86/local-def-dllimport.ll, which tested ThinLTO. Does that test need to be changed? Is the main issue that we were only testing ThinLTO and not regular LTO?

No, I don't think we need to modify the original test. It's now used to test the changes in d2ef8c1f.

tejohnson accepted this revision.May 3 2023, 8:37 AM

lgtm

No, I don't think we need to modify the original test. It's now used to test the changes in d2ef8c1f.

Ah I see. Looks like that test was then actually testing the similar support in llvm/lib/Transforms/Utils/FunctionImportUtils.cpp (which is why it was affected by d2ef8c1f aka D74751), and not the support in LTO.cpp added in D55627. Which makes me wonder if we now have any tests covering the removal of the dllimport in FunctionImportUtils.cpp... After looking, that was added in f5220fb68f2baef2e6d2e0bf11c12caa9e22ef29 and there was a test added with it (llvm/test/ThinLTO/X86/dsolocal_dllimport.ll). Can you make sure that test is still testing the handling in FunctionImportUtils.cpp, and also add a comment to llvm/test/LTO/Resolution/X86/local-def-dllimport.ll as to what it is actually testing (which I guess is that we *don't* remove the dllimport if we didn't mark a def as dso_local during the function import handling?).

This revision is now accepted and ready to land.May 3 2023, 8:37 AM
This revision was landed with ongoing or failed builds.May 3 2023, 11:20 AM
This revision was automatically updated to reflect the committed changes.

Thanks! I'll take a look at those other testing-related questions...