Merge changes from topic 'clang-3625443'

* changes:
  Disable optimization of Atomic::LoadJavaData for x86 targets.
  Ignore warning for instantiation after specialization.
diff --git a/runtime/atomic.h b/runtime/atomic.h
index e2a7259..090e56a 100644
--- a/runtime/atomic.h
+++ b/runtime/atomic.h
@@ -201,6 +201,11 @@
     return this->load(std::memory_order_acquire);
   }
 
+  // Disable optimizations for Atomic::LoadJavaData on x86 devices.
+  // Bug: http://b/34287931
+#if defined(DISABLE_LOAD_JAVA_DATA_OPTIMIZATIONS)
+  #pragma clang optimize off
+#endif
   // Word tearing allowed, but may race.
   // TODO: Optimize?
   // There has been some discussion of eventually disallowing word
@@ -208,6 +213,9 @@
   T LoadJavaData() const {
     return this->load(std::memory_order_relaxed);
   }
+#if defined(DISABLE_LOAD_JAVA_DATA_OPTIMIZATIONS)
+  #pragma clang optimize on
+#endif
 
   // Load from memory with a total ordering.
   // Corresponds exactly to a Java volatile load.
diff --git a/runtime/base/arena_allocator.cc b/runtime/base/arena_allocator.cc
index 61e0aab..1caf0c0 100644
--- a/runtime/base/arena_allocator.cc
+++ b/runtime/base/arena_allocator.cc
@@ -144,8 +144,11 @@
   }
 }
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Winstantiation-after-specialization"
 // Explicitly instantiate the used implementation.
 template class ArenaAllocatorStatsImpl<kArenaAllocatorCountAllocations>;
+#pragma GCC diagnostic pop
 
 void ArenaAllocatorMemoryTool::DoMakeDefined(void* ptr, size_t size) {
   MEMORY_TOOL_MAKE_DEFINED(ptr, size);
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 02b26c6..efbce3d 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -14,6 +14,12 @@
  * limitations under the License.
  */
 
+// Disable optimizations for Atomic::LoadJavaData on x86 devices.
+// Bug: http://b/34287931
+#if defined(__i386__)
+#define DISABLE_LOAD_JAVA_DATA_OPTIMIZATIONS
+#endif
+
 #include "class_linker.h"
 
 #include <algorithm>