[llvm] [RISCV] Enable load clustering by default (PR #73789)

Wang Pengcheng via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 3 22:52:31 PST 2023


================
@@ -2281,9 +2282,9 @@ bool RISCVInstrInfo::shouldClusterMemOps(
     return false;
   }
 
-  // TODO: Use a more carefully chosen heuristic, e.g. only cluster if offsets
-  // indicate they likely share a cache line.
-  return ClusterSize <= 4;
+  // A cache line is typically 64 bytes, so cluster if the memory ops are on
----------------
wangpc-pp wrote:

We can get cache line size via `TargetTransformInfo::getCacheLineSize` or `MCSubtargetInfo::getCacheLineSize` (for the default implementation, `TargetTransformInfo::getCacheLineSize` just calls `MCSubtargetInfo::getCacheLineSize`). If the return value is not 0, we can use it as a more exact value.
For RISCV, the cache line size info can be specified when defining processor.

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


More information about the llvm-commits mailing list