[PATCH] D107574: [GlobalOpt] [MemoryBuiltins] Update getMallocType with bitcast on stored pointer
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 10 14:16:40 PDT 2021
efriedma added a comment.
At this point, the code is really specific to GlobalOpt transform; maybe we want to move it into GlobalOpt.cpp?
================
Comment at: llvm/lib/Analysis/MemoryBuiltins.cpp:354
// The size of the malloc's result type must be known to determine array size.
Type *T = getMallocAllocatedType(CI, TLI);
if (!T || !T->isSized())
----------------
Update here as well?
================
Comment at: llvm/lib/Analysis/MemoryBuiltins.cpp:366
Value *Multiple = nullptr;
if (ComputeMultiple(MallocArg, ElementSize, Multiple, LookThroughSExt))
return Multiple;
----------------
We still end up blocking the transform in some cases: if the malloc size isn't a multiple of the type inferred by getMallocType(), the transform fails.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107574/new/
https://reviews.llvm.org/D107574
More information about the llvm-commits
mailing list