Skip to content

Instantly share code, notes, and snippets.

@tetsuok
Forked from socantre/foil_optimizer.cpp
Created February 7, 2016 23:56
Show Gist options
  • Save tetsuok/3c5c6975c5040fde549c to your computer and use it in GitHub Desktop.
Save tetsuok/3c5c6975c5040fde549c 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