This is an archive of the discontinued LLVM Phabricator instance.

[SROA] Support opaque pointers
ClosedPublic

Authored by nikic on Sep 3 2021, 2:17 PM.

Details

Reviewers
aeubanks
Group Reviewers
Restricted Project
Commits
rG6dfdc6bfd22a: [SROA] Support opaque pointers
Summary

Make the following changes in order to support opaque pointers in SROA:

  • Generate i8 GEPs for opaque pointers.
  • Explicitly enforce that promotable allocas only have stores of the alloca type -- previously this was implicitly enforced.
  • Replace a check for pointer element type with load/store type.

Diff Detail

Event Timeline

nikic created this revision.Sep 3 2021, 2:17 PM
nikic requested review of this revision.Sep 3 2021, 2:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 3 2021, 2:17 PM

I think we should revisit the i8 GEP discussion again in llvm-dev, last time in https://groups.google.com/g/llvm-dev/c/NkslevE-MGM/m/jY1CkHxfBAAJ I think there wasn't enough consensus around this.

aeubanks accepted this revision.Sep 7 2021, 2:08 PM
aeubanks added inline comments.
llvm/test/Transforms/SROA/basictest-opaque-ptrs.ll
123

in the original test this is a i64 addrspace(1)* but here we've dropped the addrspace(1)
are we missing an addrspacecast? the original code path had a cast if the final pointer type didn't match the desired pointer type

This revision is now accepted and ready to land.Sep 7 2021, 2:08 PM
aeubanks requested changes to this revision.Sep 7 2021, 2:09 PM
This revision now requires changes to proceed.Sep 7 2021, 2:09 PM
nikic updated this revision to Diff 371411.Sep 8 2021, 12:00 PM

Add missing addrspacecast, add name for GEP.

nikic marked an inline comment as done.Sep 8 2021, 12:02 PM
nikic added inline comments.
llvm/test/Transforms/SROA/basictest-opaque-ptrs.ll
123

Nice catch! I've added the missing pointer cast.

aeubanks accepted this revision.Sep 8 2021, 1:09 PM
This revision is now accepted and ready to land.Sep 8 2021, 1:09 PM
This revision was automatically updated to reflect the committed changes.
nikic marked an inline comment as done.