[PATCH] D45381: [InstCombine] Remove the hasOneUse() limitation on the malloc
Dávid Bolvanský via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 6 11:19:43 PDT 2018
xbolva00 updated this revision to Diff 141387.
https://reviews.llvm.org/D45381
Files:
lib/Transforms/Utils/SimplifyLibCalls.cpp
Index: lib/Transforms/Utils/SimplifyLibCalls.cpp
===================================================================
--- lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -840,12 +840,8 @@
if (!FillValue || FillValue->getZExtValue() != 0)
return nullptr;
- // TODO: We should handle the case where the malloc has more than one use.
- // This is necessary to optimize common patterns such as when the result of
- // the malloc is checked against null or when a memset intrinsic is used in
- // place of a memset library call.
auto *Malloc = dyn_cast<CallInst>(Memset->getArgOperand(0));
- if (!Malloc || !Malloc->hasOneUse())
+ if (!Malloc)
return nullptr;
// Is the inner call really malloc()?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45381.141387.patch
Type: text/x-patch
Size: 764 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180406/37ad7652/attachment.bin>
More information about the llvm-commits
mailing list