OSDN Git Service

[X86] Reorder how the subtarget map key is created.
authorCraig Topper <craig.topper@intel.com>
Fri, 17 Jul 2020 03:14:20 +0000 (20:14 -0700)
committerCraig Topper <craig.topper@intel.com>
Fri, 17 Jul 2020 04:41:45 +0000 (21:41 -0700)
commitaddbf732c83b54259d6aa2c6ed982099be0aeeaf
treee0088bda8163974a508e07570b9be4bf07707127
parent1b3c25e7b61f44b80788f8758f0d7f0b013135b5
[X86] Reorder how the subtarget map key is created.

We use a SmallString<512> and attempted to reserve enough space
for CPU plus Features, but that doesn't account for all the things
that get added to the string.

Reorder the string so the shortest things go first which shouldn't
exceed the small size. Finally add the feature string at the end
which might be long. This should ensure at most one heap allocation
without needing to use reserve.

I don't know if this matters much in practice, but I was looking
into something else that will require more code here and noticed
the odd reserve call.
llvm/lib/Target/X86/X86TargetMachine.cpp