This is an archive of the discontinued LLVM Phabricator instance.

Use SETNE directly rather than SUB/SETNE 0 for stack guard check
ClosedPublic

Authored by jrtc27 on Feb 11 2020, 5:28 PM.

Details

Summary

Backends should fold the subtraction into the comparison, but not all
seem to. Moreover, on targets where pointers are not integers, such as
CHERI, an integer subtraction is not appropriate. Instead we should just
compare the two pointers directly, as this should work everywhere and
potentially generate more efficient code.

Diff Detail

Event Timeline

jrtc27 created this revision.Feb 11 2020, 5:28 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 11 2020, 5:28 PM
lebedev.ri accepted this revision.Feb 12 2020, 8:53 AM

This seems obviously correct(C) to me, so LG, https://rise4fun.com/Alive/rR6
Git speluking suggests it was that way since the beginning (rL188755),
so it's not like this was changed the opposite way to fix something..

This revision is now accepted and ready to land.Feb 12 2020, 8:53 AM
This revision was automatically updated to reflect the committed changes.