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.
Paths
| Differential D67679
[SLC] Convert some strndup calls to strdup calls ClosedPublic Authored by xbolva00 on Sep 17 2019, 1:42 PM.
Details Summary Motivation:
strdup and strndup are part of C 20 (currently posix fns), so we should optimize them.
Diff Detail Event Timelinexbolva00 retitled this revision from [SLC] Convert some strdup calls to strndup calls to [SLC] Convert some strndup calls to strdup calls. Comment Actions optimizeStrNDup seems fine to me, the breakage that you mentioned need to be addressed though. xbolva00 added inline comments.
Comment Actions I think some patches just severely lack words. Comment Actions Multiple reasons
p.s: strdup and strndup are part of C 20 :) Comment Actions
Put this in the commit message. I missed that it was empty, thanks @lebedev.ri. This revision is now accepted and ready to land.Sep 23 2019, 5:13 AM Closed by commit rL372636: [SLC] Convert some strndup calls to strdup calls (authored by xbolva00). · Explain WhySep 23 2019, 11:18 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 220663 include/llvm/Transforms/Utils/BuildLibCalls.h
include/llvm/Transforms/Utils/SimplifyLibCalls.h
lib/Transforms/InstCombine/InstCombineCalls.cpp
lib/Transforms/Utils/BuildLibCalls.cpp
lib/Transforms/Utils/SimplifyLibCalls.cpp
test/Transforms/InstCombine/objsize.ll
test/Transforms/InstCombine/strndup.ll
|
sight, this breaks things (eg. zstd build)