aboutsummaryrefslogtreecommitdiff
path: root/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2025-01-09 17:50:40 +0900
committerNAKAMURA Takumi <geek4civic@gmail.com>2025-01-09 17:50:40 +0900
commitfea7da1b00cc97d742faede2df96c7d327950f49 (patch)
tree4de1d6b4ddc69f4f32daabb11ad5c71ab0cf895e /mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
parent9b99dde0d47102625d93c5d1cbbc04951025a6c9 (diff)
parent0aa930a41f2d1ebf1fa90ec42da8f96d15a4dcbb (diff)
downloadllvm-users/chapuni/cov/single/nextcount.zip
llvm-users/chapuni/cov/single/nextcount.tar.gz
llvm-users/chapuni/cov/single/nextcount.tar.bz2
Merge branch 'users/chapuni/cov/single/nextcount-base' into users/chapuni/cov/single/nextcountusers/chapuni/cov/single/nextcount
Diffstat (limited to 'mlir/lib/Target/LLVMIR/ModuleTranslation.cpp')
-rw-r--r--mlir/lib/Target/LLVMIR/ModuleTranslation.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
index ad62ae0..4367100 100644
--- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
@@ -1724,25 +1724,36 @@ ModuleTranslation::getOrCreateAliasScope(AliasScopeAttr aliasScopeAttr) {
aliasScopeAttr.getDomain(), nullptr);
if (insertedDomain) {
llvm::SmallVector<llvm::Metadata *, 2> operands;
- // Placeholder for self-reference.
+ // Placeholder for potential self-reference.
operands.push_back(dummy.get());
if (StringAttr description = aliasScopeAttr.getDomain().getDescription())
operands.push_back(llvm::MDString::get(ctx, description));
domainIt->second = llvm::MDNode::get(ctx, operands);
// Self-reference for uniqueness.
- domainIt->second->replaceOperandWith(0, domainIt->second);
+ llvm::Metadata *replacement;
+ if (auto stringAttr =
+ dyn_cast<StringAttr>(aliasScopeAttr.getDomain().getId()))
+ replacement = llvm::MDString::get(ctx, stringAttr.getValue());
+ else
+ replacement = domainIt->second;
+ domainIt->second->replaceOperandWith(0, replacement);
}
// Convert the scope metadata node.
assert(domainIt->second && "Scope's domain should already be valid");
llvm::SmallVector<llvm::Metadata *, 3> operands;
- // Placeholder for self-reference.
+ // Placeholder for potential self-reference.
operands.push_back(dummy.get());
operands.push_back(domainIt->second);
if (StringAttr description = aliasScopeAttr.getDescription())
operands.push_back(llvm::MDString::get(ctx, description));
scopeIt->second = llvm::MDNode::get(ctx, operands);
// Self-reference for uniqueness.
- scopeIt->second->replaceOperandWith(0, scopeIt->second);
+ llvm::Metadata *replacement;
+ if (auto stringAttr = dyn_cast<StringAttr>(aliasScopeAttr.getId()))
+ replacement = llvm::MDString::get(ctx, stringAttr.getValue());
+ else
+ replacement = scopeIt->second;
+ scopeIt->second->replaceOperandWith(0, replacement);
return scopeIt->second;
}