This is an archive of the discontinued LLVM Phabricator instance.

[Attributor] Generalize GEP construction
ClosedPublic

Authored by nikic on Oct 21 2021, 12:43 PM.

Details

Summary

Make use of the getGEPIndicesForOffset() helper for creating GEPs. This handles arrays as well, uses correct GEP index types and reduces code duplication.

Diff Detail

Event Timeline

nikic created this revision.Oct 21 2021, 12:43 PM
nikic requested review of this revision.Oct 21 2021, 12:43 PM
Herald added a reviewer: sstefan1. · View Herald Transcript
Herald added a reviewer: baziotis. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
jdoerfert accepted this revision.Oct 21 2021, 2:06 PM

LG, thanks!

llvm/lib/Transforms/IPO/AttributorAttributes.cpp
197

The TODO can now be removed I guess.

This revision is now accepted and ready to land.Oct 21 2021, 2:06 PM
nikic added inline comments.Oct 21 2021, 2:31 PM
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
197

There's probably still room for a higher-level abstraction that generates the actual GEP or bitcast + gep + bitcast sequence.

This revision was automatically updated to reflect the committed changes.