[all-commits] [llvm/llvm-project] ab736a: [BasicTTI] Account for vector of pointers in getMe...

Philip Reames via All-commits all-commits at lists.llvm.org
Sat Jun 25 11:17:30 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ab736a2750a99b303f8d6a216f754fb3577abb88
      https://github.com/llvm/llvm-project/commit/ab736a2750a99b303f8d6a216f754fb3577abb88
  Author: Philip Reames <preames at rivosinc.com>
  Date:   2022-06-25 (Sat, 25 Jun 2022)

  Changed paths:
    M llvm/include/llvm/CodeGen/BasicTTIImpl.h
    M llvm/test/Analysis/CostModel/RISCV/rvv-load-store.ll

  Log Message:
  -----------
  [BasicTTI] Account for vector of pointers in getMemoryOpCost

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.

Differential Revision: https://reviews.llvm.org/D128228




More information about the All-commits mailing list