Unify Unix arm compiler optimization options (dotnet/coreclr#26299)
authorJan Vorlicek <janvorli@microsoft.com>
Wed, 28 Aug 2019 00:01:52 +0000 (02:01 +0200)
committerJan Kotas <jkotas@microsoft.com>
Wed, 28 Aug 2019 00:01:52 +0000 (17:01 -0700)
Long time ago, we were using clang 3.8 for building for Unix arm. There
was a codegen bug that forced us to set optimization for release build
to -O1 instead of -O3.
Now the minimum clang version we use for arm is 5.0 and I've verified
that binaries compiled with -O3 pass all the Coreclr pri 1 tests and so
the issue is gone.
So this change unifies the optimization levels for all architectures.

Commit migrated from https://github.com/dotnet/coreclr/commit/a7b43df9208036ebeb56bf0cd6c498aef3692407

src/coreclr/configureoptimization.cmake

index dd26849..71a04e7 100644 (file)
@@ -4,19 +4,8 @@ if(WIN32)
     add_compile_options($<$<CONFIG:Release>:/Ox>)
     add_compile_options($<$<CONFIG:RelWithDebInfo>:/O2>)
 elseif(CLR_CMAKE_PLATFORM_UNIX)
-    set(CLR_CMAKE_ARM_OPTIMIZATION_FALLBACK OFF)
-    if(CLR_CMAKE_TARGET_ARCH STREQUAL "arm" OR CLR_CMAKE_TARGET_ARCH STREQUAL "armel")
-        if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.9))
-            set(CLR_CMAKE_ARM_OPTIMIZATION_FALLBACK ON)
-        endif()
-    endif()
     add_compile_options($<$<CONFIG:Debug>:-O0>)
-    if (CLR_CMAKE_ARM_OPTIMIZATION_FALLBACK)
-        add_compile_options($<$<NOT:$<CONFIG:Debug>>:-O1>)
-    else()
-        add_compile_options($<$<CONFIG:Checked>:-O2>)
-        add_compile_options($<$<CONFIG:Release>:-O3>)
-        add_compile_options($<$<CONFIG:RelWithDebInfo>:-O2>)
-    endif()
-
+    add_compile_options($<$<CONFIG:Checked>:-O2>)
+    add_compile_options($<$<CONFIG:Release>:-O3>)
+    add_compile_options($<$<CONFIG:RelWithDebInfo>:-O2>)
 endif()