Page MenuHomePhabricator

D16532.diff
No OneTemporary

D16532.diff

Index: lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -9022,7 +9022,8 @@
return DAG.getNode(ISD::FABS, SDLoc(N), VT, N0);
// copysign(x, copysign(y,z)) -> copysign(x, z)
- if (N1.getOpcode() == ISD::FCOPYSIGN)
+ if (DAG.getTarget().Options.UnsafeFPMath &&
+ N1.getOpcode() == ISD::FCOPYSIGN)
return DAG.getNode(ISD::FCOPYSIGN, SDLoc(N), VT,
N0, N1.getOperand(1));
Index: test/CodeGen/X86/sse-fcopysign.ll
===================================================================
--- test/CodeGen/X86/sse-fcopysign.ll
+++ test/CodeGen/X86/sse-fcopysign.ll
@@ -152,3 +152,19 @@
declare float @llvm.copysign.f32(float %Mag, float %Sgn)
declare double @llvm.copysign.f64(double %Mag, double %Sgn)
+
+;
+; Unsafe transformations
+;
+
+define double @safe(float %a, double %b) "unsafe-fp-math"="false" {
+; CHECK-LABEL: safe:
+; CHECK: andps
+; CHECK-NEXT: orps
+; CHECK: cvtss2sd
+
+ %r1 = call float @llvm.copysign.f32(float 1.000000e+00, float %a)
+ %r2 = fpext float %r1 to double
+ %r3 = call double @llvm.copysign.f64(double %b, double %r2)
+ ret double %r3
+}

File Metadata

Mime Type
text/plain
Expires
Sat, Aug 9, 7:50 AM (11 h, 46 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
9076910
Default Alt Text
D16532.diff (1 KB)

Event Timeline