Skip to content

Instantly share code, notes, and snippets.

@socantre
Last active August 11, 2019 17:36
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save socantre/9597a38ece66058737eb to your computer and use it in GitHub Desktop.
Save socantre/9597a38ece66058737eb to your computer and use it in GitHub Desktop.
CppCon 2015: Chandler Carruth "Tuning C++: Benchmarks, and CPUs, and Compilers! Oh My!" functions to disable compiler optimization
static void escape(void *p) {
asm volatile("" : : "g"(p) : "memory");
}
static void clobber() {
asm volatile("" : : : "memory");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment