[PATCH] D110584: [Analysis] Be defensive when matching size_t in lib call signatures

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 27 14:38:28 PDT 2021


bjope added inline comments.


================
Comment at: llvm/lib/Analysis/TargetLibraryInfo.cpp:734
   // sizeof(int*) for every target. So the assumption used here to derive the
   // SizeTTy based on DataLayout and getIntPtrType isn't always valid.
   Type *SizeTTy = DL ? DL->getIntPtrType(Ctx, /*AddressSpace=*/0) : nullptr;
----------------
nikic wrote:
> As a side note, I believe this should really be using the integer type with width DL.getIndexSizeInBits(). Basically pointer size = intptr_t and index size = size_t.
Ok. I did not know about "index size = size_t" relation.

(Makes me wonder about the index type in the DataLayout for our OOT target. We haven't configured that afaict, so we get index size = pointer size by default. But in our target size_t is different from intptr_t. So we should probably specify those optional params in the data layout to set the IndexSize. Will be interesting to see if that will impact something else.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110584/new/

https://reviews.llvm.org/D110584



More information about the llvm-commits mailing list