Page MenuHomePhabricator

[asan] Prevent rematerialization of &__asan_shadow.

Authored by eugenis on Nov 14 2017, 1:25 PM.



In the mode when ASan shadow base is computed as the address of an
external global (__asan_shadow, currently on android/arm32 only),
regalloc prefers to rematerialize this value to save register spills.
Even in -Os. On arm32 it is rather expensive (2 loads + 1 constant
pool entry).

This changes adds an inline asm in the function prologue to suppress
this behavior. It reduces AsanTest binary size by 7%.

Diff Detail


Event Timeline

eugenis created this revision.Nov 14 2017, 1:25 PM
pcc added inline comments.Nov 14 2017, 1:37 PM
216 ↗(On Diff #122902)

Does this need to be a flag? Could we instead do this only on arm32?

eugenis added inline comments.Nov 14 2017, 2:02 PM
216 ↗(On Diff #122902)

Flag is useful for benchmarking and also as a way to disable this feature if something goes wrong. We already do this only on android/arm32.

pcc accepted this revision.Nov 14 2017, 2:30 PM


216 ↗(On Diff #122902)

Please at least remember to remove this flag once you know that it works well.

This revision is now accepted and ready to land.Nov 14 2017, 2:30 PM
This revision was automatically updated to reflect the committed changes.