aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2018-02-20 16:22:18 +0000
committerHans Wennborg <hans@hanshq.net>2018-02-20 16:22:18 +0000
commit2e49864b29e689c4b51ab214572346bb05567e40 (patch)
tree3d58f408da050313c64b3c372c08733449c71d98 /lib
parent22a047b7bdc982e02c510d72d640d66cd34b8c4d (diff)
Merging r325525:
------------------------------------------------------------------------ r325525 | steven_wu | 2018-02-19 20:22:28 +0100 (Mon, 19 Feb 2018) | 13 lines bitcode support change for fast flags compatibility Summary: The discussion and as per need, each vendor needs a way to keep the old fast flags and the new fast flags in the auto upgrade path of the IR upgrader. This revision addresses that issue. Patched by Michael Berg Reviewers: qcolombet, hans, steven_wu Reviewed By: qcolombet, steven_wu Subscribers: dexonsmith, vsk, mehdi_amini, andrewrk, MatzeB, wristow, spatel Differential Revision: https://reviews.llvm.org/D43253 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@325592 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Bitcode/Reader/BitcodeReader.cpp16
-rw-r--r--lib/Bitcode/Writer/BitcodeWriter.cpp16
2 files changed, 17 insertions, 15 deletions
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp
index 95291a1caf9..945ac451536 100644
--- a/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1046,19 +1046,21 @@ static Comdat::SelectionKind getDecodedComdatSelectionKind(unsigned Val) {
static FastMathFlags getDecodedFastMathFlags(unsigned Val) {
FastMathFlags FMF;
- if (0 != (Val & FastMathFlags::AllowReassoc))
+ if (0 != (Val & bitc::UnsafeAlgebra))
+ FMF.setFast();
+ if (0 != (Val & bitc::AllowReassoc))
FMF.setAllowReassoc();
- if (0 != (Val & FastMathFlags::NoNaNs))
+ if (0 != (Val & bitc::NoNaNs))
FMF.setNoNaNs();
- if (0 != (Val & FastMathFlags::NoInfs))
+ if (0 != (Val & bitc::NoInfs))
FMF.setNoInfs();
- if (0 != (Val & FastMathFlags::NoSignedZeros))
+ if (0 != (Val & bitc::NoSignedZeros))
FMF.setNoSignedZeros();
- if (0 != (Val & FastMathFlags::AllowReciprocal))
+ if (0 != (Val & bitc::AllowReciprocal))
FMF.setAllowReciprocal();
- if (0 != (Val & FastMathFlags::AllowContract))
+ if (0 != (Val & bitc::AllowContract))
FMF.setAllowContract(true);
- if (0 != (Val & FastMathFlags::ApproxFunc))
+ if (0 != (Val & bitc::ApproxFunc))
FMF.setApproxFunc();
return FMF;
}
diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp
index a7201ed9735..7bf37857eb9 100644
--- a/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -1330,19 +1330,19 @@ static uint64_t getOptimizationFlags(const Value *V) {
Flags |= 1 << bitc::PEO_EXACT;
} else if (const auto *FPMO = dyn_cast<FPMathOperator>(V)) {
if (FPMO->hasAllowReassoc())
- Flags |= FastMathFlags::AllowReassoc;
+ Flags |= bitc::AllowReassoc;
if (FPMO->hasNoNaNs())
- Flags |= FastMathFlags::NoNaNs;
+ Flags |= bitc::NoNaNs;
if (FPMO->hasNoInfs())
- Flags |= FastMathFlags::NoInfs;
+ Flags |= bitc::NoInfs;
if (FPMO->hasNoSignedZeros())
- Flags |= FastMathFlags::NoSignedZeros;
+ Flags |= bitc::NoSignedZeros;
if (FPMO->hasAllowReciprocal())
- Flags |= FastMathFlags::AllowReciprocal;
+ Flags |= bitc::AllowReciprocal;
if (FPMO->hasAllowContract())
- Flags |= FastMathFlags::AllowContract;
+ Flags |= bitc::AllowContract;
if (FPMO->hasApproxFunc())
- Flags |= FastMathFlags::ApproxFunc;
+ Flags |= bitc::ApproxFunc;
}
return Flags;
@@ -3183,7 +3183,7 @@ void ModuleBitcodeWriter::writeBlockInfo() {
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LHS
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // RHS
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 4)); // opc
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7)); // flags
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8)); // flags
if (Stream.EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID, Abbv) !=
FUNCTION_INST_BINOP_FLAGS_ABBREV)
llvm_unreachable("Unexpected abbrev ordering!");