diff --git a/support/xhpast/Makefile b/support/xhpast/Makefile
--- a/support/xhpast/Makefile
+++ b/support/xhpast/Makefile
@@ -8,7 +8,7 @@
 	CPPFLAGS   += -ggdb -DDEBUG
 	FLEXFLAGS  += --debug
 else
-	CPPFLAGS  += -O3 -minline-all-stringops
+	CPPFLAGS   += -O3 $(shell ./bin/xhpast-generate-release-cppflags.php)
 endif
 
 ifdef PROFILE
diff --git a/support/xhpast/bin/xhpast-generate-release-cppflags.php b/support/xhpast/bin/xhpast-generate-release-cppflags.php
new file mode 100755
--- /dev/null
+++ b/support/xhpast/bin/xhpast-generate-release-cppflags.php
@@ -0,0 +1,15 @@
+#!/usr/bin/env php
+<?php
+
+// $arcanist_root = dirname(dirname(dirname(dirname(__FILE__))));
+// require_once $arcanist_root.'/support/init/init-script.php';
+
+$cppflags = '';
+$arch = php_uname('m');
+
+if ($arch == 'i386' || $arch == 'x86_64') {
+  $cppflags .= ' -minline-all-stringops ';
+}
+
+echo $cppflags;
+echo "\n";