This is an archive of the discontinued LLVM Phabricator instance.

[SimplifyLibCalls] Remove over-eager early return in strlen optzns.
ClosedPublic

Authored by fhahn on Aug 13 2020, 2:40 AM.

Details

Summary

Currently we bail out early for strlen calls with a GEP operand, if none
of the GEP specific optimizations fire. But there could be later
optimizations that still apply, which we currently miss out on.

An example is that we do not apply the following optimization

strlen(x) == 0 --> *x == 0

Unless I am missing something, there seems to be no reason for bailing
out early there.

Fixes PR47149.

Diff Detail

Event Timeline

fhahn created this revision.Aug 13 2020, 2:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 13 2020, 2:40 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
fhahn requested review of this revision.Aug 13 2020, 2:40 AM
xbolva00 accepted this revision.Aug 13 2020, 2:49 AM
xbolva00 added a subscriber: xbolva00.

LG

This revision is now accepted and ready to land.Aug 13 2020, 2:49 AM
lebedev.ri accepted this revision.Aug 13 2020, 6:16 AM

Not really familiar with the code, but that return does seem wrong.