HomePhabricator

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

Description

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

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).

Differential Revision: https://reviews.llvm.org/D57766

Details

Committed
jyknightFeb 8 2019, 7:34 AM
Differential Revision
D57766: [opaque pointer types] Cleanup CGBuilder's Create*GEP.
Parents
rL353528: [scudo][standalone] Correct cmake copy/paste error
Branches
Unknown
Tags
Unknown