diff options
-rw-r--r-- | llvm/docs/ReleaseNotes.rst | 4 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 4 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/ftrunc.ll | 7 |
3 files changed, 7 insertions, 8 deletions
diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst index 06f3f1a9c19..85d0eafa814 100644 --- a/llvm/docs/ReleaseNotes.rst +++ b/llvm/docs/ReleaseNotes.rst @@ -64,8 +64,8 @@ Non-comprehensive list of changes in this release * 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": diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index aefccd2e365..5c47fe21ec8 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -10915,8 +10915,8 @@ static SDValue foldFPToIntToFP(SDNode *N, SelectionDAG &DAG, // 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 diff --git a/llvm/test/CodeGen/X86/ftrunc.ll b/llvm/test/CodeGen/X86/ftrunc.ll index 356de29e591..74f1022f311 100644 --- a/llvm/test/CodeGen/X86/ftrunc.ll +++ b/llvm/test/CodeGen/X86/ftrunc.ll @@ -356,9 +356,8 @@ define <4 x double> @trunc_signed_v4f64(<4 x double> %x) nounwind { 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 @@ define double @trunc_signed_f64_disable_via_attr(double %x) #1 { ret double %r } -attributes #1 = { nounwind "fp-cast-overflow-workaround"="true" } +attributes #1 = { nounwind "strict-float-cast-overflow"="false" } |