summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDavid Bolvansky <david.bolvansky@gmail.com>2019-09-11 10:37:03 +0000
committerDavid Bolvansky <david.bolvansky@gmail.com>2019-09-11 10:37:03 +0000
commit4dae283cd3e74f0ccacac14b3080a321cee740b3 (patch)
tree51e86c3a362288b55664164c8a51c104d322a434 /llvm/lib/Transforms
parente79381c3f7a6da15dc632ecf02ab38805bf2761a (diff)
downloadbcm5719-llvm-4dae283cd3e74f0ccacac14b3080a321cee740b3.tar.gz
bcm5719-llvm-4dae283cd3e74f0ccacac14b3080a321cee740b3.zip
[InstCombine] Fixed handling of isOpNewLike (PR11748)
llvm-svn: 371602
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index 3863e5fcb8f..1cef8d956b7 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -4190,13 +4190,14 @@ static void annotateAnyAllocSite(CallBase &Call, const TargetLibraryInfo *TLI) {
return;
if (isMallocLikeFn(&Call, TLI) && Op0C) {
- Call.addAttribute(AttributeList::ReturnIndex,
- Attribute::getWithDereferenceableOrNullBytes(
- Call.getContext(), Op0C->getZExtValue()));
- } else if (isOpNewLikeFn(&Call, TLI) && Op0C) {
- Call.addAttribute(AttributeList::ReturnIndex,
- Attribute::getWithDereferenceableBytes(
- Call.getContext(), Op0C->getZExtValue()));
+ if (isOpNewLikeFn(&Call, TLI))
+ Call.addAttribute(AttributeList::ReturnIndex,
+ Attribute::getWithDereferenceableBytes(
+ Call.getContext(), Op0C->getZExtValue()));
+ else
+ Call.addAttribute(AttributeList::ReturnIndex,
+ Attribute::getWithDereferenceableOrNullBytes(
+ Call.getContext(), Op0C->getZExtValue()));
} else if (isReallocLikeFn(&Call, TLI) && Op1C) {
Call.addAttribute(AttributeList::ReturnIndex,
Attribute::getWithDereferenceableOrNullBytes(
OpenPOWER on IntegriCloud