This is an archive of the discontinued LLVM Phabricator instance.

Support arbitrary address space pointers in masked gather/scatter intrinsics
ClosedPublic

Authored by eladcohen on Mar 30 2017, 1:41 AM.

Details

Summary

Fixes PR31789 - When loop-vectorize tries to use these intrinsics for a non-default address space pointer we fail with a "Calling a function with a bad signature!" assertion. This patch tries to solve this by adding the 'vector of pointers' argument as an overloaded type which will determine the address space.

Diff Detail

Event Timeline

eladcohen created this revision.Mar 30 2017, 1:41 AM
delena added inline comments.Apr 3 2017, 5:07 AM
lib/IR/Function.cpp
1053

I suggest to keep the standard (or close to standard) Argument_Info structure and access it though functions.

eladcohen updated this revision to Diff 95692.Apr 19 2017, 12:34 AM

Fixed Elena's comments.

zvi edited edge metadata.Apr 19 2017, 4:04 AM

I might have missed something, but all the examples in the langref and test-cases include only pointers to addspace(0). Maybe change/add tests and example to include non-zero address-spaces?

In D31490#730229, @zvi wrote:

I might have missed something, but all the examples in the langref and test-cases include only pointers to addspace(0). Maybe change/add tests and example to include non-zero address-spaces?

I have added new test-cases in test/Transforms/LoopVectorize/X86/gather_scatter.ll to check that the Loop Vectorizer can successfully create scatter/gather instructions for pointers in the non-default address space.
I'll add non-default address space examples to the langref - thanks!

eladcohen updated this revision to Diff 95712.Apr 19 2017, 4:41 AM

Fixed Zvi's comment (Added a non-default addrspace example to the LangRef)

delena added inline comments.Apr 19 2017, 6:41 AM
lib/IR/Function.cpp
724

This is one more place where I suggest to replace the hardcoded "shift" with a method.

eladcohen updated this revision to Diff 95738.Apr 19 2017, 7:16 AM

Fixed Elena's comment.

eladcohen marked an inline comment as done.Apr 19 2017, 7:17 AM
delena accepted this revision.Apr 19 2017, 11:20 PM
This revision is now accepted and ready to land.Apr 19 2017, 11:20 PM
This revision was automatically updated to reflect the committed changes.

Thanks for the review! Committed r302018