mirror of
https://github.com/intel/llvm.git
synced 2026-01-25 19:44:38 +08:00
[mlir] Always create a list of alias scopes when emitting LLVM IR
Previously, the translation to LLVM IR would emit IR that directly uses
a scope metadata node in case only one scope was in use in alias.scopes
or noalias metadata. It should always be a list of scopes. The verifier
change in 8700f2bd36 enforced this and
broke the test. Fix the translation to always create a list of scopes
using a new metadata node, update and reenable the respective test.
Fixes PR51919.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D110140
This commit is contained in:
@@ -944,11 +944,7 @@ void ModuleTranslation::setAliasScopeMetadata(Operation *op,
|
||||
SmallVector<llvm::Metadata *> scopeMDs;
|
||||
for (SymbolRefAttr scopeRef : scopes.getAsRange<SymbolRefAttr>())
|
||||
scopeMDs.push_back(getAliasScope(*op, scopeRef));
|
||||
llvm::MDNode *unionMD = nullptr;
|
||||
if (scopeMDs.size() == 1)
|
||||
unionMD = llvm::cast<llvm::MDNode>(scopeMDs.front());
|
||||
else if (scopeMDs.size() >= 2)
|
||||
unionMD = llvm::MDNode::get(module->getContext(), scopeMDs);
|
||||
llvm::MDNode *unionMD = llvm::MDNode::get(module->getContext(), scopeMDs);
|
||||
inst->setMetadata(module->getMDKindID(llvmMetadataName), unionMD);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user