================
@@ -919,13 +919,46 @@ rewriteCallOrInvoke(mlir::Operation *op, mlir::ValueRange
callOperands,
memoryEffects, noUnwind, willReturn);
mlir::LLVM::LLVMFunctionType llvmFnTy;
+
+ // Temporary to handle the case where we need to prepend an operand if the
+ // callee is an alias.
+ SmallVector<mlir::Value> adjustedCallOperands;
+
if (calleeAttr) { // direct call
- mlir::FunctionOpInterface fn =
- mlir::SymbolTable::lookupNearestSymbolFrom<mlir::FunctionOpInterface>(
- op, calleeAttr);
- assert(fn && "Did not find function for call");
- llvmFnTy = cast<mlir::LLVM::LLVMFunctionType>(
- converter->convertType(fn.getFunctionType()));
+ mlir::Operation *callee =
+ mlir::SymbolTable::lookupNearestSymbolFrom(op, calleeAttr);
+ if (auto fn = dyn_cast<mlir::FunctionOpInterface>(callee)) {
+ llvmFnTy = cast<mlir::LLVM::LLVMFunctionType>(
+ converter->convertType(fn.getFunctionType()));
+ } else if (auto alias = cast<mlir::LLVM::AliasOp>(callee)) {
----------------
xlauko wrote:
```suggestion
} else if (auto alias = mlir::cast<mlir::LLVM::AliasOp>(callee)) {
```
https://github.com/llvm/llvm-project/pull/150520
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits