Patch optimizes the following case:
unsigned memcpy_strlen (char *d) {
memcpy (d, "aaaa", 5); // ... return strlen(d); // optimize to 4
}
if between memcpy and strlen calls "d" is modified, transformation is not performed.
Paths
| Differential D45599
[SimplifyLibcalls] Memcpy + strlen propagation AbandonedPublic Authored by xbolva00 on Apr 12 2018, 3:50 PM.
Details
Diff Detail Event TimelineComment Actions GVN should already be able to get this, and if it can't, improve it's intrinsic handling (Either in VNCoercion's memory transfer intrinsic handling, or ...). That's gonna do a lot better than trying to special case it in libcall simplification. Comment Actions
Ok, so I will close this change. If you know GVN, check this case..
Revision Contents
Diff 142293 lib/Transforms/Utils/SimplifyLibCalls.cpp
test/Transforms/InstCombine/memcpy-strlen.ll
|