summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorMichael Berg <michael_c_berg@apple.com>2019-10-14 17:39:32 +0000
committerMichael Berg <michael_c_berg@apple.com>2019-10-14 17:39:32 +0000
commit5af0201c2a08370fd3782b445cd96603d7988fd4 (patch)
treefe39c1bd6677965bf9ae6601d287517de052c81d /llvm
parent1d32d8b176dc3c89b26c8322120cfeeb0f31ff2d (diff)
downloadbcm5719-llvm-5af0201c2a08370fd3782b445cd96603d7988fd4.tar.gz
bcm5719-llvm-5af0201c2a08370fd3782b445cd96603d7988fd4.zip
Add FMF to vector ops for phi
Summary: Small amendment to handle vector cases for D67564. Reviewers: spatel, eli.friedman, hfinkel, cameron.mcinally, arsenm, jmolloy, bogner Reviewed By: cameron.mcinally, bogner Subscribers: llvm-commits, efriedma, reames, bogner, wdng Differential Revision: https://reviews.llvm.org/D68748 llvm-svn: 374794
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp2
-rw-r--r--llvm/test/Bitcode/compatibility.ll21
2 files changed, 22 insertions, 1 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index bd1115f238b..9bf3947b111 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -4641,7 +4641,7 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
// There is an optional final record for fast-math-flags if this phi has a
// floating-point type.
size_t NumArgs = (Record.size() - 1) / 2;
- if ((Record.size() - 1) % 2 == 1 && !Ty->isFloatingPointTy())
+ if ((Record.size() - 1) % 2 == 1 && !Ty->isFPOrFPVectorTy())
return error("Invalid record");
PHINode *PN = PHINode::Create(Ty, NumArgs);
diff --git a/llvm/test/Bitcode/compatibility.ll b/llvm/test/Bitcode/compatibility.ll
index 3bc806229d0..615e618131f 100644
--- a/llvm/test/Bitcode/compatibility.ll
+++ b/llvm/test/Bitcode/compatibility.ll
@@ -882,6 +882,27 @@ exit:
ret void
}
+define void @fastmathflags_vector_phi(i1 %cond, <4 x float> %f1, <4 x float> %f2, <2 x double> %d1, <2 x double> %d2, <8 x half> %h1, <8 x half> %h2) {
+entry:
+ br i1 %cond, label %L1, label %L2
+L1:
+ br label %exit
+L2:
+ br label %exit
+exit:
+ %p.nnan = phi nnan <4 x float> [ %f1, %L1 ], [ %f2, %L2 ]
+ ; CHECK: %p.nnan = phi nnan <4 x float> [ %f1, %L1 ], [ %f2, %L2 ]
+ %p.ninf = phi ninf <2 x double> [ %d1, %L1 ], [ %d2, %L2 ]
+ ; CHECK: %p.ninf = phi ninf <2 x double> [ %d1, %L1 ], [ %d2, %L2 ]
+ %p.contract = phi contract <8 x half> [ %h1, %L1 ], [ %h2, %L2 ]
+ ; CHECK: %p.contract = phi contract <8 x half> [ %h1, %L1 ], [ %h2, %L2 ]
+ %p.nsz.reassoc = phi reassoc nsz <4 x float> [ %f1, %L1 ], [ %f2, %L2 ]
+ ; CHECK: %p.nsz.reassoc = phi reassoc nsz <4 x float> [ %f1, %L1 ], [ %f2, %L2 ]
+ %p.fast = phi fast <8 x half> [ %h2, %L1 ], [ %h1, %L2 ]
+ ; CHECK: %p.fast = phi fast <8 x half> [ %h2, %L1 ], [ %h1, %L2 ]
+ ret void
+}
+
; Check various fast math flags and floating-point types on calls.
declare float @fmf1()
OpenPOWER on IntegriCloud