force read for doNotOptimizeAway(*ptr_to_small_trivial)
Summary:
doNotOptimizeAway's "X" input operand constraint is interpreted
more loosely by gcc than by clang, resulting in surprising behavior
for doNotOptimizeAway(*ptr) and a difference in behavior between gcc
and clang benchmarks. clang also is more aggressive about placing an
input operand into a register even when the constraint would allow it to
be in memory, so an "r,m" constraint has a similar problem. This diff
changes the input constraint so that register-sized values must actually
be copied into a register, which makes the behavior more intuitive and
more consistent across platforms.
Reviewed By: davidtgoldblatt
Differential Revision:
D4199767
fbshipit-source-id:
aa56a7b11cb3229b95da87295f0dfc38476959d2