[PATCH] D76283: [IRBuilder] Use preferred target type for len argument of memory intrinsic functions

2023-08-17 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm added inline comments. Comment at: llvm/include/llvm/IR/IRBuilder.h:438-446 + ConstantInt *getIntPtrSize(Value *Ptr, uint64_t Size) { +assert(BB && "Must have a basic block to retrieve the module!"); + +Module *M = BB->getParent()->getParent(); +auto *PtrType

[PATCH] D76283: [IRBuilder] Use preferred target type for len argument of memory intrinsic functions

2023-08-17 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm requested changes to this revision. arsenm added a comment. This revision now requires changes to proceed. Herald added a project: All. I think any size type should be valid for the intrinsic. Legalization should have to cast the type to the target libcall if that's how it chooses to

[PATCH] D76283: [IRBuilder] Use preferred target type for len argument of memory intrinsic functions

2020-06-10 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm added a comment. In D76283#2084627 , @kschwarz wrote: > I brought this to the mailing list > (http://lists.llvm.org/pipermail/llvm-dev/2020-March/140032.html) but didn't > get an answer there. > > @arsenm, have you any comments regarding

[PATCH] D76283: [IRBuilder] Use preferred target type for len argument of memory intrinsic functions

2020-06-10 Thread Guillaume Chatelet via Phabricator via cfe-commits
gchatelet added a comment. I would harden the verifier and declare the i64 versions of mem intrinsics illegal on 32 bits architectures. Also the intrinsic sections of LangRef should be updated accordingly. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D76283: [IRBuilder] Use preferred target type for len argument of memory intrinsic functions

2020-06-10 Thread Konstantin Schwarz via Phabricator via cfe-commits
kschwarz added a comment. I brought this to the mailing list (http://lists.llvm.org/pipermail/llvm-dev/2020-March/140032.html) but didn't get an answer there. @arsenm, have you any comments regarding @rjmccall's last comment regarding the sizes of pointers in different address spaces?

[PATCH] D76283: [IRBuilder] Use preferred target type for len argument of memory intrinsic functions

2020-06-10 Thread Konstantin Schwarz via Phabricator via cfe-commits
kschwarz updated this revision to Diff 269789. kschwarz added a comment. Herald added a project: LLVM. Brining this up again Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D76283/new/ https://reviews.llvm.org/D76283 Files:

[PATCH] D76283: [IRBuilder] Use preferred target type for len argument of memory intrinsic functions

2020-03-17 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment. I guess the logical rule would be that the bit-width of the size has to match the minimum of the bit-widths of the address spaces used with the intrinsic. (Note that `llvm.memcpy` etc. can take pointers into two different address spaces, potentially of different

[PATCH] D76283: [IRBuilder] Use preferred target type for len argument of memory intrinsic functions

2020-03-17 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. llvm-dev might be a better place for that question, wider coverage. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D76283/new/ https://reviews.llvm.org/D76283 ___ cfe-commits

[PATCH] D76283: [IRBuilder] Use preferred target type for len argument of memory intrinsic functions

2020-03-17 Thread Konstantin Schwarz via Phabricator via cfe-commits
kschwarz added a comment. Correct, it will still miscompile even with this change. I see two options: either 1) extend GlobalISel to select to the appropriate type, or 2) declare this as illegal LLVM IR in the first place. 1. will introduce an implicit truncation of the i64 argument (same as

[PATCH] D76283: [IRBuilder] Use preferred target type for len argument of memory intrinsic functions

2020-03-17 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. So what happens if i manually create such IR, or create such IR without using IRBuilder? It will again compile fine via SelectionDAG and will be miscompiled via GlobalISel, correct? Don't you then want to harden `-verify` to barf on such mismatch, too? Repository:

[PATCH] D76283: [IRBuilder] Use preferred target type for len argument of memory intrinsic functions

2020-03-17 Thread Konstantin Schwarz via Phabricator via cfe-commits
kschwarz created this revision. kschwarz added reviewers: rjmccall, gchatelet, aemerson. Herald added subscribers: cfe-commits, jfb. Herald added a project: clang. The IR builder hard-coded the type of the `len` argument of the memory function instrinsics to i64 for several builder functions.