[llvm] [RISCV] Add optimization for memset inline (PR #146673)

Pengcheng Wang via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 3 23:55:33 PDT 2025


================
@@ -2019,9 +2019,9 @@ class LLVM_ABI TargetLoweringBase {
   /// a result of memset, memcpy, and memmove lowering.
   /// It returns EVT::Other if the type should be determined using generic
   /// target-independent logic.
-  virtual EVT
-  getOptimalMemOpType(const MemOp &Op,
-                      const AttributeList & /*FuncAttributes*/) const {
+  virtual EVT getOptimalMemOpType(const MemOp &Op,
+                                  const AttributeList & /*FuncAttributes*/,
+                                  LLVMContext *Context = nullptr) const {
----------------
wangpc-pp wrote:

I think it should be like:
```
virtual EVT getOptimalMemOpType(LLVMContext &Context, const MemOp &Op,
                                  const AttributeList & /*FuncAttributes*/) const
```
Just always pass the context like `allowsMemoryAccess` above

https://github.com/llvm/llvm-project/pull/146673


More information about the llvm-commits mailing list