[llvm] [Analysis] Ensure use of strict fp exceptions in ConstantFolding (PR #136139)

Lucas Duarte Prates via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 17 07:38:53 PDT 2025


================
@@ -23,6 +23,17 @@ if (DEFINED LLVM_HAVE_TF_AOT OR LLVM_HAVE_TFLITE)
   endif()
 endif()
 
+# The implementaiton of ConstantFolding.cpp relies on the use of math functions
+# from the host. In particular, it relies on the detection of floating point
+# exceptions originating from such math functions to prevent invalid cases
+# from being constant folded. Therefore, we must ensure that fp exceptions are
+# handled correctly.
+if (MSVC)
+  set_source_files_properties(ConstantFolding.cpp PROPERTIES COMPILE_OPTIONS "/fp:except")
+else()
----------------
pratlucas wrote:

Good point, I've updated the condition.

https://github.com/llvm/llvm-project/pull/136139


More information about the llvm-commits mailing list