summaryrefslogtreecommitdiffstats
path: root/llvm/test/Bitcode
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2019-09-25 14:35:02 +0000
committerSanjay Patel <spatel@rotateright.com>2019-09-25 14:35:02 +0000
commit6d4ea22e70924da411998edcbdb321bfd3f17545 (patch)
tree84b7966c637e95a309134ab2ac71575c655b507e /llvm/test/Bitcode
parentb2befe47dc4067416729080bd4531af6197bc265 (diff)
downloadbcm5719-llvm-6d4ea22e70924da411998edcbdb321bfd3f17545.tar.gz
bcm5719-llvm-6d4ea22e70924da411998edcbdb321bfd3f17545.zip
[IR] allow fast-math-flags on phi of FP values (2nd try)
The changes here are based on the corresponding diffs for allowing FMF on 'select': D61917 <https://reviews.llvm.org/D61917> As discussed there, we want to have fast-math-flags be a property of an FP value because the alternative (having them on things like fcmp) leads to logical inconsistency such as: https://bugs.llvm.org/show_bug.cgi?id=38086 The earlier patch for select made almost no practical difference because most unoptimized conditional code begins life as a phi (based on what I see in clang). Similarly, I don't expect this patch to do much on its own either because SimplifyCFG promptly drops the flags when converting to select on a minimal example like: https://bugs.llvm.org/show_bug.cgi?id=39535 But once we have this plumbing in place, we should be able to wire up the FMF propagation and start solving cases like that. The change to RecurrenceDescriptor::AddReductionVar() is required to prevent a regression in a LoopVectorize test. We are intersecting the FMF of any FPMathOperator there, so if a phi is not properly annotated, new math instructions may not be either. Once we fix the propagation in SimplifyCFG, it may be safe to remove that hack. Differential Revision: https://reviews.llvm.org/D67564 llvm-svn: 372878
Diffstat (limited to 'llvm/test/Bitcode')
-rw-r--r--llvm/test/Bitcode/compatibility.ll21
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/test/Bitcode/compatibility.ll b/llvm/test/Bitcode/compatibility.ll
index b17aeda8ebb..9e7f6ac9917 100644
--- a/llvm/test/Bitcode/compatibility.ll
+++ b/llvm/test/Bitcode/compatibility.ll
@@ -861,6 +861,27 @@ define void @fastmathflags_vector_select(<2 x i1> %cond, <2 x double> %op1, <2 x
ret void
}
+define void @fastmathflags_phi(i1 %cond, float %f1, float %f2, double %d1, double %d2, half %h1, half %h2) {
+entry:
+ br i1 %cond, label %L1, label %L2
+L1:
+ br label %exit
+L2:
+ br label %exit
+exit:
+ %p.nnan = phi nnan float [ %f1, %L1 ], [ %f2, %L2 ]
+ ; CHECK: %p.nnan = phi nnan float [ %f1, %L1 ], [ %f2, %L2 ]
+ %p.ninf = phi ninf double [ %d1, %L1 ], [ %d2, %L2 ]
+ ; CHECK: %p.ninf = phi ninf double [ %d1, %L1 ], [ %d2, %L2 ]
+ %p.contract = phi contract half [ %h1, %L1 ], [ %h2, %L2 ]
+ ; CHECK: %p.contract = phi contract half [ %h1, %L1 ], [ %h2, %L2 ]
+ %p.nsz.reassoc = phi reassoc nsz float [ %f1, %L1 ], [ %f2, %L2 ]
+ ; CHECK: %p.nsz.reassoc = phi reassoc nsz float [ %f1, %L1 ], [ %f2, %L2 ]
+ %p.fast = phi fast half [ %h2, %L1 ], [ %h1, %L2 ]
+ ; CHECK: %p.fast = phi fast half [ %h2, %L1 ], [ %h1, %L2 ]
+ ret void
+}
+
; Check various fast math flags and floating-point types on calls.
declare float @fmf1()
OpenPOWER on IntegriCloud