Skip to content

Commit

Permalink
annotation2Metadata: shouldn’t do dropAllReferences
Browse files Browse the repository at this point in the history
  • Loading branch information
61bcdefg committed Apr 12, 2023
1 parent 62371bc commit 083025a
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ void annotation2Metadata(Module &M) {
auto *C = dyn_cast<ConstantArray>(Annotations->getInitializer());
if (!C)
return;
std::vector<ConstantStruct *> toDelete;
for (unsigned int i = 0; i < C->getNumOperands(); i++)
if (ConstantStruct *CS = dyn_cast<ConstantStruct>(C->getOperand(i))) {
GlobalValue *StrC =
Expand All @@ -230,15 +229,12 @@ void annotation2Metadata(Module &M) {
if (!Fn)
continue;

toDelete.emplace_back(CS);
// Add annotation to the function.
std::vector<std::string> strs =
splitString(StrData->getAsCString().str());
for (std::string str : strs)
writeAnnotationMetadata(Fn, str);
}
for (ConstantStruct *CS : toDelete)
CS->dropAllReferences();
}

bool readAnnotationMetadata(Function *f, std::string annotation) {
Expand Down

0 comments on commit 083025a

Please sign in to comment.