aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2019-09-25 13:29:09 +0000
committerSanjay Patel <spatel@rotateright.com>2019-09-25 13:29:09 +0000
commit2cec4b58f5ce7d5c843dbfb753b0acb29c81cfc0 (patch)
tree742840a75e3e3e25c93dc802a9003cc0b091b883 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent791526085338594381adcacc13f04a4834e56d36 (diff)
downloadllvm-2cec4b58f5ce7d5c843dbfb753b0acb29c81cfc0.zip
llvm-2cec4b58f5ce7d5c843dbfb753b0acb29c81cfc0.tar.gz
llvm-2cec4b58f5ce7d5c843dbfb753b0acb29c81cfc0.tar.bz2
Revert [IR] allow fast-math-flags on phi of FP values
This reverts r372866 (git commit dec03223a97af0e4dfcb23da55c0f7f8c9b62d00) llvm-svn: 372868
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp29
1 files changed, 6 insertions, 23 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 9c37755..89a5b7b 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -4629,48 +4629,31 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
InstructionList.push_back(I);
break;
case bitc::FUNC_CODE_INST_PHI: { // PHI: [ty, val0,bb0, ...]
- if (Record.size() < 1)
+ if (Record.size() < 1 || ((Record.size()-1)&1))
return error("Invalid record");
- // The first record specifies the type.
FullTy = getFullyStructuredTypeByID(Record[0]);
Type *Ty = flattenPointerTypes(FullTy);
if (!Ty)
return error("Invalid record");
- // Phi arguments are pairs of records of [value, basic block].
- // 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())
- return error("Invalid record");
-
- PHINode *PN = PHINode::Create(Ty, NumArgs);
+ PHINode *PN = PHINode::Create(Ty, (Record.size()-1)/2);
InstructionList.push_back(PN);
- for (unsigned i = 0; i != NumArgs; i++) {
+ for (unsigned i = 0, e = Record.size()-1; i != e; i += 2) {
Value *V;
// With the new function encoding, it is possible that operands have
// negative IDs (for forward references). Use a signed VBR
// representation to keep the encoding small.
if (UseRelativeIDs)
- V = getValueSigned(Record, i * 2 + 1, NextValueNo, Ty);
+ V = getValueSigned(Record, 1+i, NextValueNo, Ty);
else
- V = getValue(Record, i * 2 + 1, NextValueNo, Ty);
- BasicBlock *BB = getBasicBlock(Record[i * 2 + 2]);
+ V = getValue(Record, 1+i, NextValueNo, Ty);
+ BasicBlock *BB = getBasicBlock(Record[2+i]);
if (!V || !BB)
return error("Invalid record");
PN->addIncoming(V, BB);
}
I = PN;
-
- // If there are an even number of records, the final record must be FMF.
- if (Record.size() % 2 == 0) {
- assert(isa<FPMathOperator>(I) && "Unexpected phi type");
- FastMathFlags FMF = getDecodedFastMathFlags(Record[Record.size() - 1]);
- if (FMF.any())
- I->setFastMathFlags(FMF);
- }
-
break;
}