Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions llvm/lib/Bitcode/Reader/BitcodeReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7015,13 +7015,6 @@ Error BitcodeReader::materialize(GlobalValue *GV) {
if (StripDebugInfo)
stripDebugInfo(*F);

// Upgrade any old intrinsic calls in the function.
for (auto &I : UpgradedIntrinsics) {
for (User *U : llvm::make_early_inc_range(I.first->materialized_users()))
if (CallInst *CI = dyn_cast<CallInst>(U))
UpgradeIntrinsicCall(CI, I.second);
}

// Finish fn->subprogram upgrade for materialized functions.
if (DISubprogram *SP = MDLoader->lookupSubprogramForFunction(F))
F->setSubprogram(SP);
Expand All @@ -7037,7 +7030,7 @@ Error BitcodeReader::materialize(GlobalValue *GV) {
}
}

for (auto &I : instructions(F)) {
for (auto &I : make_early_inc_range(instructions(F))) {
// "Upgrade" older incorrect branch weights by dropping them.
if (auto *MD = I.getMetadata(LLVMContext::MD_prof)) {
if (MD->getOperand(0) != nullptr && isa<MDString>(MD->getOperand(0))) {
Expand Down Expand Up @@ -7068,15 +7061,22 @@ Error BitcodeReader::materialize(GlobalValue *GV) {
}
}

// Remove incompatible attributes on function calls.
if (auto *CI = dyn_cast<CallBase>(&I)) {
// Remove incompatible attributes on function calls.
CI->removeRetAttrs(AttributeFuncs::typeIncompatible(
CI->getFunctionType()->getReturnType(), CI->getRetAttributes()));

for (unsigned ArgNo = 0; ArgNo < CI->arg_size(); ++ArgNo)
CI->removeParamAttrs(ArgNo, AttributeFuncs::typeIncompatible(
CI->getArgOperand(ArgNo)->getType(),
CI->getParamAttributes(ArgNo)));

// Upgrade intrinsics.
if (Function *OldFn = CI->getCalledFunction()) {
auto It = UpgradedIntrinsics.find(OldFn);
if (It != UpgradedIntrinsics.end())
UpgradeIntrinsicCall(CI, It->second);
}
}
}

Expand Down
Loading