Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LoopIdiomRecognizer] creates memset_pattern16 with incorrect size type with custom dl #57679

Open
nunoplopes opened this issue Sep 11, 2022 · 1 comment

Comments

@nunoplopes
Copy link
Member

Take, e.g., Transforms/LoopIdiom/unroll-custom-dl.ll. It creates this call:

; 64-bit size, 32-bit offset
target datalayout = "e-p:64:64:64:32-..."

  call void @memset_pattern16(i8* %f1, i8* bitcast ([4 x i32]* @.memset_pattern to i8*), i32 %3)

TargetLibraryInfo.def has this:

/// void memset_pattern16(void *b, const void *pattern16, size_t len);
TLI_DEFINE_ENUM_INTERNAL(memset_pattern16)
TLI_DEFINE_STRING_INTERNAL("memset_pattern16")
TLI_DEFINE_SIG_INTERNAL(Void, Ptr, Ptr, SizeT)

The end result is that the function isn't recognized as a libcall as there's a mismatch.
I believe the code shouldn't be using the index type for the last argument.

@efriedma-quic
Copy link
Collaborator

TargetLibraryInfo computes the size of size_t as unsigned SizeTBits = M.getDataLayout().getPointerSizeInBits(/*AddrSpace=*/0);.

We should be consistent... but it's not obvious to me what's actually likely to be correct. We don't actually have any in-tree targets where the index size is smaller than the pointer size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants