[PATCH] D46237: [DAGCombiner] rename function attribute for disabling ftrunc transform

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 29 08:35:43 PDT 2018


spatel created this revision.
spatel added reviewers: rsmith, chandlerc.
Herald added a subscriber: mcrosier.

This is the matching name change for the Clang patch at https://reviews.llvm.org/D46236.


https://reviews.llvm.org/D46237

Files:
  docs/ReleaseNotes.rst
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  test/CodeGen/X86/ftrunc.ll


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" }
 
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: 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":
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46237.144482.patch
Type: text/x-patch
Size: 2442 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180429/5c9a9d1c/attachment.bin>


More information about the llvm-commits mailing list