diff options
author | David Bolvansky <david.bolvansky@gmail.com> | 2019-08-28 15:04:48 +0000 |
---|---|---|
committer | David Bolvansky <david.bolvansky@gmail.com> | 2019-08-28 15:04:48 +0000 |
commit | af118bb6d0c4b847617d6660f8bae0073f5812b7 (patch) | |
tree | 69fa3e4f6cff55c250c6ee11cfa117ffd724ff7c | |
parent | 329442192625284cedc3190795e1c046f933ea33 (diff) | |
download | bcm5719-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.cpp | 2 |
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( |