This is an archive of the discontinued LLVM Phabricator instance.

[opaque pointer types] Pass value type to GetElementPtr creation.
ClosedPublic

Authored by jyknight on Jan 24 2019, 10:55 AM.

Details

Summary

This cleans up all GetElementPtr creation in LLVM to explicitly pass a
value type rather than deriving it from the pointer's element-type.

Diff Detail

Repository
rL LLVM

Event Timeline

jyknight created this revision.Jan 24 2019, 10:55 AM

Oops, I just noticed I accidentally included the API removals into this review, but those are intended to come later in the series, after I finish the needed changes to clang.

I'll remove them from here and re-upload.

dblaikie accepted this revision.Jan 24 2019, 2:23 PM

Sounds good - thanks!

llvm/include/llvm/IR/Constants.h
1153 ↗(On Diff #183345)

What overload sets are these nullptr+delete versions meant to account for?

This revision is now accepted and ready to land.Jan 24 2019, 2:23 PM
jyknight updated this revision to Diff 183799.Jan 27 2019, 9:02 PM
jyknight marked an inline comment as done.

Rebased and removed API changes that weren't supposed to be in here yet.

jyknight added inline comments.Jan 27 2019, 9:02 PM
llvm/include/llvm/IR/Constants.h
1153 ↗(On Diff #183345)

This change was not intended to be in this patch (and is now removed).

But it'll be back in a future patch, so I'll explain anyhow. Unlike the other instructions (Load, Call, Invoke), the GEP creation APIs mostly already have a mandatory Type argument -- but unfortunately allow it to be nullptr, in which case it defaults to the pointee type. These overloads (which are copies of all the GEP-creation APIs, with Type* -> nullptr) are to help catch and fix those callers.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 1 2019, 12:45 PM