summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Bolvansky <david.bolvansky@gmail.com>2019-08-28 15:04:48 +0000
committerDavid Bolvansky <david.bolvansky@gmail.com>2019-08-28 15:04:48 +0000
commitaf118bb6d0c4b847617d6660f8bae0073f5812b7 (patch)
tree69fa3e4f6cff55c250c6ee11cfa117ffd724ff7c
parent329442192625284cedc3190795e1c046f933ea33 (diff)
downloadbcm5719-llvm-af118bb6d0c4b847617d6660f8bae0073f5812b7.tar.gz
bcm5719-llvm-af118bb6d0c4b847617d6660f8bae0073f5812b7.zip
[NFC] Added a comment to avoid possible confusion
llvm-svn: 370217
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index c3be8c4e9a9..d304f98ceae 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -4183,8 +4183,10 @@ static void annotateAnyAllocSite(CallBase &Call, const TargetLibraryInfo *TLI) {
ConstantInt *Op1C = (Call.getNumArgOperands() == 1)
? nullptr
: dyn_cast<ConstantInt>(Call.getOperand(1));
+ // Bail out if the allocation size is zero.
if ((Op0C && Op0C->isNullValue()) || (Op1C && Op1C->isNullValue()))
return;
+
if (isMallocLikeFn(&Call, TLI) && Op0C) {
Call.addAttribute(AttributeList::ReturnIndex,
Attribute::getWithDereferenceableOrNullBytes(
OpenPOWER on IntegriCloud