This is an archive of the discontinued LLVM Phabricator instance.

[ubsan] Don't check alignment if the alignment is 1
ClosedPublic

Authored by vsk on Feb 22 2017, 6:30 PM.

Details

Summary

If a pointer is 1-byte aligned, there's no use in checking its
alignment. Somewhat surprisingly, ubsan can spend a significant amount
of time doing just that!

This loosely depends on D30283.

Testing: check-clang, check-ubsan, and a stage2 ubsan build.

I also compiled X86FastISel.cpp with -fsanitize=alignment using
patched/unpatched clangs based on r295686 with D30283 applied. Here are
the number of alignment checks emitted:

Setup# of alignment checks
unpatched + D30283, -O014307
patched + D30283, -O012515

Diff Detail

Repository
rL LLVM

Event Timeline

vsk created this revision.Feb 22 2017, 6:30 PM
filcab accepted this revision.Feb 23 2017, 4:00 AM
filcab added a subscriber: filcab.

LGTM

This revision is now accepted and ready to land.Feb 23 2017, 4:00 AM
This revision was automatically updated to reflect the committed changes.