[llvm] r331210 - [DAGCombiner] rename function attribute for disabling ftrunc transform

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 30 11:20:33 PDT 2018


Author: spatel
Date: Mon Apr 30 11:20:33 2018
New Revision: 331210

URL: http://llvm.org/viewvc/llvm-project?rev=331210&view=rev
Log:
[DAGCombiner] rename function attribute for disabling ftrunc transform

This is the matching name change for the Clang patch at:
D46236
rL331209

Differential Revision: https://reviews.llvm.org/D46237 

Modified:
    llvm/trunk/docs/ReleaseNotes.rst
    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    llvm/trunk/test/CodeGen/X86/ftrunc.ll

Modified: llvm/trunk/docs/ReleaseNotes.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.rst?rev=331210&r1=331209&r2=331210&view=diff
==============================================================================
--- llvm/trunk/docs/ReleaseNotes.rst (original)
+++ llvm/trunk/docs/ReleaseNotes.rst Mon Apr 30 11:20:33 2018
@@ -64,8 +64,8 @@ Non-comprehensive list of changes in thi
 * 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":
 

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=331210&r1=331209&r2=331210&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Apr 30 11:20:33 2018
@@ -10915,8 +10915,8 @@ static SDValue foldFPToIntToFP(SDNode *N
   // 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

Modified: llvm/trunk/test/CodeGen/X86/ftrunc.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/ftrunc.ll?rev=331210&r1=331209&r2=331210&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/ftrunc.ll (original)
+++ llvm/trunk/test/CodeGen/X86/ftrunc.ll Mon Apr 30 11:20:33 2018
@@ -356,9 +356,8 @@ define <4 x double> @trunc_signed_v4f64(
   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_
   ret double %r
 }
 
-attributes #1 = { nounwind "fp-cast-overflow-workaround"="true" }
+attributes #1 = { nounwind "strict-float-cast-overflow"="false" }
 




More information about the llvm-commits mailing list