This is an archive of the discontinued LLVM Phabricator instance.

IR: Define byref attribute
ClosedPublic

Authored by arsenm on Jul 9 2020, 3:41 PM.

Details

Summary

This includes the base IR changes, and some tests for places where it
should be treated similarly to byval. Codegen support will be in a
future patch.

I realized I do need the type, in the case of pointers. I need to know
the address space of pointer arguments (and the alignment of the
pointee, but that is one of the gaps that would need to be fixed to
only use byref parameters for kernels).

Diff Detail

Event Timeline

arsenm created this revision.Jul 9 2020, 3:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 9 2020, 3:41 PM
arsenm planned changes to this revision.Jul 9 2020, 4:52 PM

I just realized a reason why in the ultimate end state, the actual pointee type is still useful

arsenm updated this revision to Diff 277082.Jul 10 2020, 10:06 AM
arsenm edited the summary of this revision. (Show Details)

Preserve the type, which does matter for some pointer arguments to get the address space. The pointee alignment is also significant, which would need to be solved to only use byref arguments

jdoerfert accepted this revision.Jul 20 2020, 6:01 AM

LGTM, one nit

llvm/include/llvm/IR/Argument.h
93

Nit: Comment is broken, I think. Maybe just: If hasPoint... returns true, the in-memory ABI type is returned, otherwise nullptr.

llvm/lib/AsmParser/LLParser.cpp
2606

Nice.

This revision is now accepted and ready to land.Jul 20 2020, 6:01 AM