aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2020-01-17 20:45:01 +0000
committerDimitry Andric <dim@FreeBSD.org>2020-01-17 20:45:01 +0000
commit706b4fc47bbc608932d3b491ae19a3b9cde9497b (patch)
tree4adf86a776049cbf7f69a1929c4babcbbef925eb /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent7cc9cf2bf09f069cb2dd947ead05d0b54301fb71 (diff)
Notes
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp49
1 files changed, 30 insertions, 19 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 15eead1de31a..33464412edc5 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -960,6 +960,7 @@ static FunctionSummary::FFlags getDecodedFFlags(uint64_t RawFlags) {
Flags.NoRecurse = (RawFlags >> 2) & 0x1;
Flags.ReturnDoesNotAlias = (RawFlags >> 3) & 0x1;
Flags.NoInline = (RawFlags >> 4) & 0x1;
+ Flags.AlwaysInline = (RawFlags >> 5) & 0x1;
return Flags;
}
@@ -1660,6 +1661,7 @@ Error BitcodeReader::parseAttributeGroupBlock() {
}
}
+ UpgradeFramePointerAttributes(B);
MAttributeGroups[GrpID] = AttributeList::get(Context, Idx, B);
break;
}
@@ -3936,6 +3938,7 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
if ((I = UpgradeBitCastInst(Opc, Op, ResTy, Temp))) {
if (Temp) {
InstructionList.push_back(Temp);
+ assert(CurBB && "No current BB?");
CurBB->getInstList().push_back(Temp);
}
} else {
@@ -4641,10 +4644,9 @@ 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->isFPOrFPVectorTy())
- return error("Invalid record");
-
PHINode *PN = PHINode::Create(Ty, NumArgs);
+ if ((Record.size() - 1) % 2 == 1 && !isa<FPMathOperator>(PN))
+ return error("Invalid record");
InstructionList.push_back(PN);
for (unsigned i = 0; i != NumArgs; i++) {
@@ -4761,7 +4763,7 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
const DataLayout &DL = TheModule->getDataLayout();
unsigned AS = DL.getAllocaAddrSpace();
- AllocaInst *AI = new AllocaInst(Ty, AS, Size, Align ? Align->value() : 0);
+ AllocaInst *AI = new AllocaInst(Ty, AS, Size, Align);
AI->setUsedWithInAlloca(InAlloca);
AI->setSwiftError(SwiftError);
I = AI;
@@ -5118,6 +5120,19 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
OperandBundles.emplace_back(BundleTags[Record[0]], std::move(Inputs));
continue;
}
+
+ case bitc::FUNC_CODE_INST_FREEZE: { // FREEZE: [opty,opval]
+ unsigned OpNum = 0;
+ Value *Op = nullptr;
+ if (getValueTypePair(Record, OpNum, NextValueNo, Op, &FullTy))
+ return error("Invalid record");
+ if (OpNum != Record.size())
+ return error("Invalid record");
+
+ I = new FreezeInst(Op);
+ InstructionList.push_back(I);
+ break;
+ }
}
// Add instruction to end of current BB. If there is no current BB, reject
@@ -5139,7 +5154,7 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
}
// Non-void values get registered in the value table for future use.
- if (I && !I->getType()->isVoidTy()) {
+ if (!I->getType()->isVoidTy()) {
if (!FullTy) {
FullTy = I->getType();
assert(
@@ -5764,9 +5779,11 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(unsigned ID) {
}
const uint64_t Version = Record[0];
const bool IsOldProfileFormat = Version == 1;
- if (Version < 1 || Version > 7)
+ if (Version < 1 || Version > ModuleSummaryIndex::BitcodeSummaryVersion)
return error("Invalid summary version " + Twine(Version) +
- ". Version should be in the range [1-7].");
+ ". Version should be in the range [1-" +
+ Twine(ModuleSummaryIndex::BitcodeSummaryVersion) +
+ "].");
Record.clear();
// Keep around the last seen summary to be used when we see an optional
@@ -5817,7 +5834,7 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(unsigned ID) {
case bitc::FS_FLAGS: { // [flags]
uint64_t Flags = Record[0];
// Scan flags.
- assert(Flags <= 0x1f && "Unexpected bits in flag");
+ assert(Flags <= 0x3f && "Unexpected bits in flag");
// 1 bit: WithGlobalValueDeadStripping flag.
// Set on combined index only.
@@ -5840,6 +5857,10 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(unsigned ID) {
// Set on combined index only.
if (Flags & 0x10)
TheIndex.setPartiallySplitLTOUnits();
+ // 1 bit: WithAttributePropagation flag.
+ // Set on combined index only.
+ if (Flags & 0x20)
+ TheIndex.setWithAttributePropagation();
break;
}
case bitc::FS_VALUE_GUID: { // [valueid, refguid]
@@ -5905,11 +5926,6 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(unsigned ID) {
std::move(PendingTypeCheckedLoadVCalls),
std::move(PendingTypeTestAssumeConstVCalls),
std::move(PendingTypeCheckedLoadConstVCalls));
- PendingTypeTests.clear();
- PendingTypeTestAssumeVCalls.clear();
- PendingTypeCheckedLoadVCalls.clear();
- PendingTypeTestAssumeConstVCalls.clear();
- PendingTypeCheckedLoadConstVCalls.clear();
auto VIAndOriginalGUID = getValueInfoFromValueId(ValueID);
FS->setModulePath(getThisModule()->first());
FS->setOriginalName(VIAndOriginalGUID.second);
@@ -6050,11 +6066,6 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(unsigned ID) {
std::move(PendingTypeCheckedLoadVCalls),
std::move(PendingTypeTestAssumeConstVCalls),
std::move(PendingTypeCheckedLoadConstVCalls));
- PendingTypeTests.clear();
- PendingTypeTestAssumeVCalls.clear();
- PendingTypeCheckedLoadVCalls.clear();
- PendingTypeTestAssumeConstVCalls.clear();
- PendingTypeCheckedLoadConstVCalls.clear();
LastSeenSummary = FS.get();
LastSeenGUID = VI.getGUID();
FS->setModulePath(ModuleIdMap[ModuleId]);
@@ -6555,7 +6566,7 @@ static Expected<bool> getEnableSplitLTOUnitFlag(BitstreamCursor &Stream,
case bitc::FS_FLAGS: { // [flags]
uint64_t Flags = Record[0];
// Scan flags.
- assert(Flags <= 0x1f && "Unexpected bits in flag");
+ assert(Flags <= 0x3f && "Unexpected bits in flag");
return Flags & 0x8;
}