[PATCH] D85849: [X86] Flatten feature dependency tree at compile-time

Nathan Huckleberry via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 12 14:21:09 PDT 2020


Nathan-Huckleberry added inline comments.


================
Comment at: llvm/lib/Support/X86TargetParser.cpp:580
+
+static const StringMap<FlatFeatureDependency> FeatureDependencyMap({
+#define X86_FEATURE(ENUM, STR) FlattenFeatureDependencies(__COUNTER__),
----------------
craig.topper wrote:
> Doesn't this violate the no global constructor rule?
Oh yikes, yes it does. I tried making the map a function level static variable, but this code is apparently called by multiple threads in some cases so we run into race condition.

Should I switch to a static array and just do a linear search through the array?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85849/new/

https://reviews.llvm.org/D85849



More information about the llvm-commits mailing list