[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:17:43 PDT 2018
xbolva00 created this revision.
xbolva00 added a reviewer: spatel.
Herald added a subscriber: llvm-commits.
The reason that's there is discussed in https://reviews.llvm.org/D16337 - the transform must be made safe from intermediate stores.
Repository:
rL LLVM
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.141385.patch
Type: text/x-patch
Size: 764 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180406/9b127770/attachment.bin>
More information about the llvm-commits
mailing list