This is an archive of the discontinued LLVM Phabricator instance.

GlobalIFunc: Make allowed constant expressions stricter
ClosedPublic

Authored by arsenm on Nov 23 2022, 7:18 PM.

Details

Summary

This was allowing getelementptr with offsets, which doesn't make
sense. My initial attempt to use stripPointerCasts broke a few tests
involving aliases; add a new targeted verifier test for aliases.

This also provides the fix from D138537 for free, and also adds
support for addrspacecast (D138538) for free. Merge the tests in from
those.

I'm not really sure why findBaseObject exists; it seems redundant with
stripPointerCasts* (I'm also not really sure why getelementptrs are
allowed off of functions).

Diff Detail

Event Timeline

arsenm created this revision.Nov 23 2022, 7:18 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 23 2022, 7:18 PM
arsenm requested review of this revision.Nov 23 2022, 7:18 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 23 2022, 7:18 PM
Herald added a subscriber: wdng. · View Herald Transcript
MaskRay added inline comments.Nov 25 2022, 8:09 PM
llvm/test/Assembler/ifunc-addrspacecast.ll
1 ↗(On Diff #477676)

These tests test similar properties. Consider using split-file.

arsenm updated this revision to Diff 478054.Nov 26 2022, 6:26 AM

Merge tests. split-file wouldn't really help here

aeubanks accepted this revision.Dec 2 2022, 11:52 AM
aeubanks added a subscriber: aeubanks.

seems reasonable

This revision is now accepted and ready to land.Dec 2 2022, 11:52 AM
MaskRay accepted this revision.Dec 2 2022, 11:53 AM

I still think it's useful to group tests, so that readers can get all invalid cases by reading one file, instead of many

arsenm closed this revision.Dec 2 2022, 12:21 PM

f883e75497b610de81b3a6af106c976bb3c2bbb1 with merged error tests. Assembler error tests can't be split because the assembler doesn't continue past the first, but these are handled in the verifier, so moved there

I didn't request. I meant that you can improve clarify with RUN: rm -rf %t && split-file %s %t && cd %t (optional cd %t) https://llvm.org/docs/TestingGuide.html#extra-files