This is an archive of the discontinued LLVM Phabricator instance.

[opaque pointer types] Cleanup CGBuilder's Create*GEP.
ClosedPublic

Authored by jyknight on Feb 5 2019, 9:31 AM.

Details

Summary

Some of these functions take some extraneous arguments, e.g. EltSize,
Offset, which are computable from the Type and DataLayout.

Add some asserts to ensure that the computed values are consistent
with the passed-in values, in preparation for eliminating the
extraneous arguments. This also asserts that the Type is an Array for
the calls named "Array" and a Struct for the calls named "Struct".

Then, correct a couple of errors:

  1. Using CreateStructGEP on an array type. (this causes the majority of the test differences, as struct GEPs are created with i32 indices, while array GEPs are created with i64 indices)
  1. Passing the wrong Offset to CreateStructGEP in TargetInfo.cpp on x86-64 NACL (which uses 32-bit pointers).

Diff Detail

Repository
rL LLVM

Event Timeline

jyknight created this revision.Feb 5 2019, 9:31 AM
dblaikie accepted this revision.Feb 5 2019, 4:09 PM

Cool :)

This revision is now accepted and ready to land.Feb 5 2019, 4:09 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 8 2019, 7:33 AM