Page MenuHomePhabricator

[SimplifyLibCalls] Fix memchr expansion for constant strings.
ClosedPublic

Authored by efriedma on Dec 20 2018, 12:21 PM.

Details

Summary

The C standard says "The memchr function locates the first occurrence of c (converted to an unsigned char)[...]". The expansion was missing the conversion to unsigned char.

Fixes https://bugs.llvm.org/show_bug.cgi?id=39041 .

Diff Detail

Repository
rL LLVM

Event Timeline

efriedma created this revision.Dec 20 2018, 12:21 PM

Wouldn't it be more efficient to create 'and X, 255' directly?

efriedma updated this revision to Diff 179346.Dec 21 2018, 1:48 PM

Emit "and" explicitly.

spatel accepted this revision.Dec 21 2018, 1:53 PM

LGTM

This revision is now accepted and ready to land.Dec 21 2018, 1:53 PM
This revision was automatically updated to reflect the committed changes.