Solves PR11896
As noted, this can be improved futher (calloc -> malloc) in some cases. But for know, this is the first step.
Paths
| Differential D101391
[DSE] Eliminate zero memset after calloc ClosedPublic Authored by xbolva00 on Apr 27 2021, 12:31 PM.
Details
Summary Solves PR11896 As noted, this can be improved futher (calloc -> malloc) in some cases. But for know, this is the first step.
Diff Detail Event TimelineComment Actions As I worked on this PR, I found a regression where we fail to eliminate stores/memset due to inaccessiblememonly on calloc. (store_zero_after_calloc_inaccessiblememonly & zero_memset_after_calloc_inaccessiblememonly) Please check https://bugs.llvm.org/show_bug.cgi?id=50143 (but this patch can be reviewed and pushed separately). Comment Actions I think it would be good to add a negative test where there is a store to the calloc in the meantime.
Comment Actions
zero_memset_and_store_after_calloc?
Yes, good idea. Prepared partial_zero_memset_and_store_after_calloc and zero_memset_and_store_with_dyn_index_after_calloc. Comment Actions LGTM
This revision is now accepted and ready to land.Apr 27 2021, 2:12 PM This revision was landed with ongoing or failed builds.Apr 27 2021, 6:31 PM Closed by commit rGe81819377ece: [DSE] Eliminate zero memset after calloc (authored by xbolva00). · Explain Why This revision was automatically updated to reflect the committed changes. xbolva00 marked an inline comment as done.
Revision Contents
Diff 340984 llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
llvm/test/Transforms/DeadStoreElimination/noop-stores.ll
|
clang-tidy: warning: 'auto *DefUOInst' can be declared as 'const auto *DefUOInst' [llvm-qualified-auto]
not useful