[cfe-dev] [PATCH] ubsan: Emit branch metadata
Richard Smith
richard at metafoo.co.uk
Thu Dec 13 18:22:18 PST 2012
On Thu, Dec 13, 2012 at 9:23 AM, Will Dietz <willdtz at gmail.com> wrote:
> As previously discussed, default block placement for ubsan handler
> blocks (when recoverable) are suboptimal and cause poor icache
> performance.
>
> Attached is a simple patch adding strong branch hints to ensure proper
> block placement.
>
> Also, I've attached an extended version of the previous set of
> experiments that includes results for this change vs without this
> change, as well as the similarly isolated impact of using the ColdCC
> change.
>
> In summary, this minor change brings overall slowdown from 34% to 23%,
> and relative to NoRecover from 20% to 10%.
>
> Easy win :).
>
> Ok to commit?
To match the 'unreachable' weights, please use 1<<20 - 1, not 1<<20
(see lib/Analysis/BranchProbabilityInfo.cpp's UR_NONTAKEN_WEIGHT), and
also add a comment explaining where this number comes from. Please
update one of Clang's ubsan IRGen tests to check that the metadata is
being created. Then feel free to commit. Thanks!
More information about the cfe-dev
mailing list