[PATCH] D103009: [DSE] Transform memset + malloc --> calloc (PR25892)
Dávid Bolvanský via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 20 08:07:48 PDT 2021
xbolva00 added a comment.
>> there is no quick and obvious fix
There is a flag/attribute.
>> but it also disables the completely reasonable and uncontroversial transformation of memset(malloc(n), 0, n) to calloc(1, n)
1. this never worked with llvm.memset.
2. this never worked if ptr from malloc was only checked for null.
p = memset(malloc(..), 0, ..) is horrible pattern to see in real world code. Rather to have nothing than optimize this horrible pattern.
>> impacts of this transformation (when done by GCC)
And so many years passed and gcc still has it. :) it does not look like there is a storm on gcc bugzilla about this “issue” either.
Well I think users has some ways how to avoid this optimization - what we could do is to write some info into release notes.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103009/new/
https://reviews.llvm.org/D103009
More information about the llvm-commits
mailing list