X86: Do not use ValueMap for PreallocatedIds
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Mon, 18 Apr 2022 16:00:04 +0000 (12:00 -0400)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Wed, 20 Apr 2022 01:07:47 +0000 (21:07 -0400)
ValueMap should only be necessary if the IR values can be
replaced. This is only used during codegen, when it's illegal to
change the underlying IR. This allows using the default copy
constructor for X86MachineFunctionInfo.

I'm not happy about targets keeping state here that's only used in one
specific pass, but we don't have a better place to put it right now.

llvm/lib/Target/X86/X86MachineFunctionInfo.h

index 99d1a97..5c0ba2c 100644 (file)
@@ -119,7 +119,9 @@ class X86MachineFunctionInfo : public MachineFunctionInfo {
 
   Optional<int> SwiftAsyncContextFrameIdx;
 
-  ValueMap<const Value *, size_t> PreallocatedIds;
+  // Preallocated fields are only used during isel.
+  // FIXME: Can we find somewhere else to store these?
+  DenseMap<const Value *, size_t> PreallocatedIds;
   SmallVector<size_t, 0> PreallocatedStackSizes;
   SmallVector<SmallVector<size_t, 4>, 0> PreallocatedArgOffsets;