This is an archive of the discontinued LLVM Phabricator instance.

[BasicTTI] Account for vector of pointers in getMemoryOpCost
ClosedPublic

Authored by reames on Jun 20 2022, 2:27 PM.

Details

Summary

By using getPrimitiveSizeInBits, we were getting 0 for every pointer type. This code is trying to account for the cost of truncating a store or extending a load to convert from the source vector element type to the legal vector element type.

I'd originally seen this as a crash when trying to scalarize a <vscale x 1 x ptr> type coming from the vectorizer. Here's a minimum reproducer to exercise the code in question.

void e(int *argv[], int *p) {
  for (int i = 0; i < 1024; i++)
    argv[i] = p;
}

This was checked in as the splat_ptr test in 2cf320d. After bbf3fd, this no longer crashes since we correctly return invalid if the extending load/truncating store isn't legal.

Diff Detail

Event Timeline

reames created this revision.Jun 20 2022, 2:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 20 2022, 2:27 PM
reames requested review of this revision.Jun 20 2022, 2:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 20 2022, 2:27 PM
reames edited the summary of this revision. (Show Details)Jun 21 2022, 1:54 PM
reames updated this revision to Diff 438842.Jun 21 2022, 2:50 PM
reames edited the summary of this revision. (Show Details)

Rebase over newly added tests - after thinking about this a bit more, I realized this was exerciseable through CostModel.

This revision is now accepted and ready to land.Jun 24 2022, 11:21 PM
This revision was landed with ongoing or failed builds.Jun 25 2022, 11:17 AM
This revision was automatically updated to reflect the committed changes.