[llvm] [MC] Allocate MCFragment with a bump allocator (PR #96402)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 22 11:41:29 PDT 2024


================
@@ -136,6 +136,9 @@ class MCContext {
   /// objects.
   BumpPtrAllocator Allocator;
 
+  /// For MCFragment instances.
+  BumpPtrAllocator FragmentAllocator;
----------------
MaskRay wrote:

Make fragments closer for locality.

In addition, there might be an opportunity to reduce `MCFragment::destroy` (primarily called by `~MCSection`) overhead.
If we can obtain BumpPtrAllocator slabs, there will probably be a better way to implement `-mc-disable-free` like `-cc1 -disable-free`.

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


More information about the llvm-commits mailing list