Skip to content

Commit 52ca57e

Browse files
committed
Update comment
1 parent 1007de6 commit 52ca57e

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

llvm/lib/Analysis/TargetLibraryInfo.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,16 +1459,16 @@ unsigned TargetLibraryInfoImpl::getWCharSize(const Module &M) const {
14591459
}
14601460

14611461
unsigned TargetLibraryInfoImpl::getSizeTSize(const Module &M) const {
1462-
// There is really no guarantee that sizeof(size_t) is equal to sizeof(int*).
1463-
// If that isn't true then it should be possible to derive the SizeTTy from
1464-
// the target triple here instead and do an early return.
1465-
1466-
// Historically LLVM assume that size_t has same size as intptr_t (hence
1467-
// deriving the size from sizeof(int*) in address space zero). This should
1468-
// work for most targets. For future consideration: Hard coding address space
1469-
// zero here might be unfortunate. Maybe getMaxIndexSizeInBits() is better.
1470-
unsigned AddressSpace = 0;
1471-
return M.getDataLayout().getIndexSizeInBits(AddressSpace);
1462+
// There is really no guarantee that sizeof(size_t) is equal to the index
1463+
// size of the default address space. If that isn't true then it should be
1464+
// possible to derive the SizeTTy from the target triple here instead and do
1465+
// an early return.
1466+
1467+
// Hard coding address space zero may seem unfortunate, but a number of
1468+
// configurations of common targets (i386, x86-64 x32, aarch64 x32, possibly
1469+
// others) have larger-than-size_t index sizes on non-default address spaces,
1470+
// making this the best default.
1471+
return M.getDataLayout().getIndexSizeInBits(/*AddressSpace=*/0);
14721472
}
14731473

14741474
TargetLibraryInfoWrapperPass::TargetLibraryInfoWrapperPass()

0 commit comments

Comments
 (0)