This is an archive of the discontinued LLVM Phabricator instance.

[ASAN] Support memory checks on vp.gather/scatter.
ClosedPublic

Authored by fakepaper56 on Apr 26 2023, 1:46 AM.

Details

Summary

The patch supports vp.gather/scatter by allowing addresses being pointer vectors.
And then we just need to check each active pointer element of those pointer vectors.

Diff Detail

Event Timeline

fakepaper56 created this revision.Apr 26 2023, 1:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 26 2023, 1:46 AM
fakepaper56 requested review of this revision.Apr 26 2023, 1:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 26 2023, 1:46 AM

Rebase. Do we have api to get the alignment of pointer vector?
IR document say we could set aligment information to pointer vector like,
%r = call <8 x i8> @llvm.vp.gather.v8i8.v8p0(<8 x ptr> align 8 %ptrs, <8 x i1> %mask, i32 %evl)
But the often used api getPointerAlignment() needs Value has pointer type.

Rebase. Do we have api to get the alignment of pointer vector?
IR document say we could set aligment information to pointer vector like,
%r = call <8 x i8> @llvm.vp.gather.v8i8.v8p0(<8 x ptr> align 8 %ptrs, <8 x i1> %mask, i32 %evl)
But the often used api getPointerAlignment() needs Value has pointer type.

There should be a getPointerAlignment in VPIntrinsic class that checks for an attribute.

Use VPIntrinsic::getPointerAlignment() to get alignment of vp.gather/scatter.

There should be a getPointerAlignment in VPIntrinsic class that checks for an attribute.

Thank you. It works.

reames accepted this revision.May 25 2023, 4:37 PM

LGTM

It is very odd to have support for vp.scatter/gather, but not the plan masked form thereof. Can you post a patch which adds support for those as well?

This revision is now accepted and ready to land.May 25 2023, 4:37 PM

LGTM

It is very odd to have support for vp.scatter/gather, but not the plan masked form thereof. Can you post a patch which adds support for those as well?

I think "plan" was supposed to be "plain"?

LGTM

It is very odd to have support for vp.scatter/gather, but not the plan masked form thereof. Can you post a patch which adds support for those as well?

I think "plan" was supposed to be "plain"?

Yep. There: https://llvm.org/docs/LangRef.html#masked-vector-gather-and-scatter-intrinsics

This revision was landed with ongoing or failed builds.May 26 2023, 12:28 AM
This revision was automatically updated to reflect the committed changes.

Can you post a patch which adds support for those as well?

Sure. I will support it right away.