From 9978d7e9e5c3a31afaca6f4a8706e7c65409b972 Mon Sep 17 00:00:00 2001 From: Michael Ilseman Date: Tue, 27 Nov 2012 00:43:38 +0000 Subject: Fast-math flags for the bitcode Added in bitcode enum for the serializing of fast-math flags. Added in the reading/writing of fast-math flags from the OptimizationFlags record for BinaryOps. llvm-svn: 168646 --- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp') diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index cf3c9fd..6206479 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -553,6 +553,18 @@ static uint64_t GetOptimizationFlags(const Value *V) { dyn_cast(V)) { if (PEO->isExact()) Flags |= 1 << bitc::PEO_EXACT; + } else if (const FPMathOperator *FPMO = + dyn_cast(V)) { + if (FPMO->hasUnsafeAlgebra()) + Flags |= 1 << bitc::FMF_UNSAFE_ALGEBRA; + if (FPMO->hasNoNaNs()) + Flags |= 1 << bitc::FMF_NO_NANS; + if (FPMO->hasNoInfs()) + Flags |= 1 << bitc::FMF_NO_INFS; + if (FPMO->hasNoSignedZeros()) + Flags |= 1 << bitc::FMF_NO_SIGNED_ZEROS; + if (FPMO->hasAllowReciprocal()) + Flags |= 1 << bitc::FMF_ALLOW_RECIPROCAL; } return Flags; -- cgit v1.1