diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp index 133d9e3bd2fb..6d9162383aab 100644 --- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp @@ -2476,7 +2476,8 @@ void CIRGenModule::emitAliasForGlobal(StringRef mangledName, // Switch any previous uses to the alias. if (op) { - llvm_unreachable("NYI"); + op->replaceAllUsesWith(alias); + op->erase(); } else { // Name already set by createCIRFunction } diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp index 34ffd1e98a76..bc81f93b7b55 100644 --- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp +++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp @@ -1177,16 +1177,19 @@ LogicalResult CallOp::verifySymbolUses(SymbolTableCollection &symbolTable) { return emitOpError() << "'" << calleeName.getValue() << "' does not reference a symbol in the current scope"; + if (auto fn = dyn_cast(callee)) { if (failed(verifyCallOpDebugInfo(*this, fn))) return failure(); fnType = fn.getFunctionType(); } else if (auto ifunc = dyn_cast(callee)) { fnType = ifunc.getIFuncType(); + } else if (auto aliasFn = dyn_cast(callee)){ + fnType = aliasFn.getType(); } else { return emitOpError() << "'" << calleeName.getValue() - << "' does not reference a valid LLVM function or IFunc"; + << "' does not reference a valid LLVM function or IFunc or Alias"; } }