This is an archive of the discontinued LLVM Phabricator instance.

[IR] Ignore globals with the `llvm.` prefix when calculating module hash
ClosedPublic

Authored by paulkirth on Jun 28 2023, 5:01 PM.

Details

Summary

This came up in This came up in
https://reviews.llvm.org/D146776#inline-1489091 and is slightly related
to https://reviews.llvm.org/D153855. In both patches, there is the
observation that some modifications of the module should not invalidate
analysis, such as when adding a declaration or some metadata the won't
be used when compiling the current module.

This patch implements the suggestion that we should ignore globals that have
the llvm. prefix when calculating the module hash.

Fixes https://github.com/llvm/llvm-project/issues/63590

Diff Detail

Event Timeline

paulkirth created this revision.Jun 28 2023, 5:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 28 2023, 5:01 PM
paulkirth requested review of this revision.Jun 28 2023, 5:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 28 2023, 5:01 PM
aeubanks added inline comments.Jun 29 2023, 1:58 PM
llvm/unittests/IR/PassManagerTest.cpp
1090 ↗(On Diff #535566)

I've been meaning to write some unittests that specifically just check (in)equality of llvm::StructuralHash of two modules so we can avoid doing that. Going through a pass manager shouldn't be necessary. I can do that, or if you have time you can start that :)

paulkirth added inline comments.Jun 29 2023, 2:12 PM
llvm/unittests/IR/PassManagerTest.cpp
1090 ↗(On Diff #535566)

I'm going on vacation starting tomorrow,so I'm not sure I'll have time to get to it until after that.

But, just in case I do scrounge the time, are there other important cases you know of of the top of your head?

aeubanks added inline comments.Jun 29 2023, 2:51 PM
llvm/unittests/IR/PassManagerTest.cpp
1090 ↗(On Diff #535566)

it's basically just all the cases in StructuralHashImpl, there aren't that many right now. it would be good to get some tests out so it's easy to test future changes

Rebase. I will update the test code after D154308 lands.

paulkirth planned changes to this revision.Jul 11 2023, 10:46 AM

As discussed I will rebase this on top of D154308, and update the tests accordingly.

paulkirth updated this revision to Diff 539311.Jul 11 2023, 3:28 PM

Rebase and update test.

This revision is now accepted and ready to land.Jul 11 2023, 7:34 PM