================
@@ -4688,10 +4670,25 @@ mlir::LogicalResult
CIRToLLVMMemChrOpLowering::matchAndRewrite(
/*isVarArg=*/false);
llvm::StringRef fnName = "memchr";
createLLVMFuncOpIfNotExist(rewriter, op, fnName, fnTy);
- rewriter.replaceOpWithNewOp<mlir::LLVM::CallOp>(
+
+ mlir::Builder b(rewriter.getContext());
+ auto noundefAttr = b.getNamedAttr("llvm.noundef", b.getUnitAttr());
+ auto noundefDict = mlir::DictionaryAttr::get(rewriter.getContext(),
+ llvm::ArrayRef(noundefAttr));
+ SmallVector<mlir::Attribute> argAttrs(3, noundefDict);
+ auto argAttrsArr = mlir::ArrayAttr::get(rewriter.getContext(), argAttrs);
+
+ auto modOp = op->getParentOfType<mlir::ModuleOp>();
+ if (auto fn = mlir::dyn_cast_or_null<mlir::LLVM::LLVMFuncOp>(
+ mlir::SymbolTable::lookupSymbolIn(modOp, fnName)))
----------------
andykaylor wrote:
This is a pretty expensive thing to do every time we call this function. You
should probably be doing this in `createLLVMFuncOpIfNotExist` instead.
https://github.com/llvm/llvm-project/pull/191457
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits