summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine
diff options
context:
space:
mode:
authorDavid Bolvansky <david.bolvansky@gmail.com>2019-09-23 18:20:01 +0000
committerDavid Bolvansky <david.bolvansky@gmail.com>2019-09-23 18:20:01 +0000
commit8d5201615542c7bb6adb90bf300a9aa4897df18a (patch)
tree7ef89ccd8c499fbee25321bedf34fbfbe13d79f4 /llvm/lib/Transforms/InstCombine
parentdba792c5229b0595a2222b36b55d74c6dc9395aa (diff)
downloadbcm5719-llvm-8d5201615542c7bb6adb90bf300a9aa4897df18a.tar.gz
bcm5719-llvm-8d5201615542c7bb6adb90bf300a9aa4897df18a.zip
[SLC] Convert some strndup calls to strdup calls
Summary: Motivation: - If we can fold it to strdup, we should (strndup does more things than strdup). - Annotation mechanism. (Works for strdup well). strdup and strndup are part of C 20 (currently posix fns), so we should optimize them. Reviewers: efriedma, jdoerfert Reviewed By: jdoerfert Subscribers: lebedev.ri, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D67679 llvm-svn: 372636
Diffstat (limited to 'llvm/lib/Transforms/InstCombine')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index 90438189f89..bf9917dbab0 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -4222,9 +4222,6 @@ Instruction *InstCombiner::visitCallBase(CallBase &Call) {
if (isAllocationFn(&Call, &TLI))
annotateAnyAllocSite(Call, &TLI);
- if (isAllocLikeFn(&Call, &TLI))
- return visitAllocSite(Call);
-
bool Changed = false;
// Mark any parameters that are known to be non-null with the nonnull
@@ -4355,6 +4352,9 @@ Instruction *InstCombiner::visitCallBase(CallBase &Call) {
if (I) return eraseInstFromFunction(*I);
}
+ if (isAllocLikeFn(&Call, &TLI))
+ return visitAllocSite(Call);
+
return Changed ? &Call : nullptr;
}
OpenPOWER on IntegriCloud