Skip to content

Instantly share code, notes, and snippets.

@vedantk
Forked from socantre/foil_optimizer.cpp
Created March 8, 2016 23:32
Show Gist options
  • Save vedantk/26aa8d2e601e51a9b0c0 to your computer and use it in GitHub Desktop.
Save vedantk/26aa8d2e601e51a9b0c0 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