[llvm] r359376 - [cmake] Disable a GCC optimization when building LLVM for MIPS
Simon Atanasyan via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 27 02:28:54 PDT 2019
Author: atanasyan
Date: Sat Apr 27 02:28:54 2019
New Revision: 359376
URL: http://llvm.org/viewvc/llvm-project?rev=359376&view=rev
Log:
[cmake] Disable a GCC optimization when building LLVM for MIPS
GCC when compiling LLVM for MIPS can introduce a jump to an uninitialized
value when shrink wrapping is enabled. As shrink wrapping is enabled in
GCC at all optimization levels, it must be disabled. This bug exists for
all versions of GCC since 4.9.2.
This partially resolves PR37701 / GCC PR target/86069.
Patch by Simon Dardis.
Differential Revision: https://reviews.llvm.org/D48069
Modified:
llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=359376&r1=359375&r2=359376&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original)
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Sat Apr 27 02:28:54 2019
@@ -248,6 +248,11 @@ if( LLVM_ENABLE_PIC )
else()
add_flag_or_print_warning("-fPIC" FPIC)
endif()
+ # GCC for MIPS can miscompile LLVM due to PR37701.
+ if(CMAKE_COMPILER_IS_GNUCXX AND LLVM_NATIVE_ARCH STREQUAL "Mips" AND
+ NOT Uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
+ add_flag_or_print_warning("-fno-shrink-wrap" FNO_SHRINK_WRAP)
+ endif()
endif()
if(NOT WIN32 AND NOT CYGWIN AND NOT (${CMAKE_SYSTEM_NAME} MATCHES "AIX" AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
More information about the llvm-commits
mailing list