This is an archive of the discontinued LLVM Phabricator instance.

Remove offset size check in nullptr arithmetic handling
ClosedPublic

Authored by andrew.w.kaylor on Sep 19 2017, 4:25 PM.

Details

Summary

This patch amends the changes that were committed from D37042 to remove the offset size check in the idiom identification routine.

That check was behaving inconsistently (from target to target) because the offset was implicitly promoted to an integer before the idiom identification routine was called. The result was that when a smaller-than-int offset was added to a nullptr, the idiom was reported as having been matched on platforms where the int size is the same as the pointer size but the idiom was reported as not having been matched on platforms where the int size and the pointer size were different.

Because this check adds little value, and because the behavior of nullptr arithmetic is undefined in all cases (and therefore at our discretion to implement as we choose), it seems best to remove this check in order to guarantee consistent behavior across all platforms.

Diff Detail

Event Timeline

This revision is now accepted and ready to land.Sep 19 2017, 5:08 PM

This was committed as r313784. I put the wrong differential revision number in the comment for that check-in.