[PATCH] D41398: Give up on array allocas in getPointerDereferenceableBytes
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 19 12:00:28 PST 2017
efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.
LGTM with one minor change.
================
Comment at: lib/IR/Value.cpp:659
} else if (auto *AI = dyn_cast<AllocaInst>(this)) {
- const ConstantInt *ArraySize = dyn_cast<ConstantInt>(AI->getArraySize());
- if (ArraySize && AI->getAllocatedType()->isSized()) {
- DerefBytes = DL.getTypeStoreSize(AI->getAllocatedType()) *
- ArraySize->getZExtValue();
+ if (AI->getAllocatedType()->isSized() && !AI->isArrayAllocation()) {
+ DerefBytes = DL.getTypeStoreSize(AI->getAllocatedType());
----------------
The allocated type of an alloca is always sized (the verifier checks this).
https://reviews.llvm.org/D41398
More information about the llvm-commits
mailing list