Index: docs/ReleaseNotes.rst =================================================================== --- docs/ReleaseNotes.rst +++ docs/ReleaseNotes.rst @@ -64,8 +64,8 @@ * Optimization of floating-point casts is improved. This may cause surprising results for code that is relying on the undefined behavior of overflowing casts. The optimization can be disabled by specifying a function attribute: - "fp-cast-overflow-workaround"="true". This attribute may be created by the - clang option :option:`-ffp-cast-overflow-workaround`. + "strict-float-cast-overflow"="false". This attribute may be created by the + clang option :option:`-fno-strict-float-cast-overflow`. Code sanitizers can be used to detect affected patterns. The option for detecting this problem alone is "-fsanitize=float-cast-overflow": Index: lib/CodeGen/SelectionDAG/DAGCombiner.cpp =================================================================== --- lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -10915,8 +10915,8 @@ // unexpected results. Ie, programs may be relying on the platform-specific // undefined behavior when the float-to-int conversion overflows. const Function &F = DAG.getMachineFunction().getFunction(); - Attribute CastWorkaround = F.getFnAttribute("fp-cast-overflow-workaround"); - if (CastWorkaround.getValueAsString().equals("true")) + Attribute StrictOverflow = F.getFnAttribute("strict-float-cast-overflow"); + if (StrictOverflow.getValueAsString().equals("false")) return SDValue(); // We only do this if the target has legal ftrunc. Otherwise, we'd likely be Index: test/CodeGen/X86/ftrunc.ll =================================================================== --- test/CodeGen/X86/ftrunc.ll +++ test/CodeGen/X86/ftrunc.ll @@ -356,9 +356,8 @@ ret <4 x double> %r } -; The attribute name is subject to change, but the fold may be -; guarded to allow existing code to continue working based on its -; assumptions of float->int overflow. +; The fold may be guarded to allow existing code to continue +; working based on its assumptions of float->int overflow. define float @trunc_unsigned_f32_disable_via_attr(float %x) #1 { ; SSE2-LABEL: trunc_unsigned_f32_disable_via_attr: @@ -413,5 +412,5 @@ ret double %r } -attributes #1 = { nounwind "fp-cast-overflow-workaround"="true" } +attributes #1 = { nounwind "strict-float-cast-overflow"="false" }