[llvm] [TableGen] Add `CodeGenIntrinsicsMap` for on-demand intrinsic creation (PR #107100)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 3 23:44:43 PDT 2024
================
@@ -107,13 +107,10 @@ getInstrForIntrinsic(const CodeGenTarget &CGT, const CodeGenIntrinsic *I) {
static const CodeGenIntrinsic *getCodeGenIntrinsic(Record *R) {
// Intrinsics need to have a static lifetime because the match table keeps
// references to CodeGenIntrinsic objects.
- static DenseMap<const Record *, std::unique_ptr<CodeGenIntrinsic>>
- AllIntrinsics;
-
- auto &Ptr = AllIntrinsics[R];
- if (!Ptr)
- Ptr = std::make_unique<CodeGenIntrinsic>(R);
- return Ptr.get();
+ static CodeGenIntrinsicMap *AllIntrinsics;
+ if (!AllIntrinsics)
+ AllIntrinsics = new CodeGenIntrinsicMap(R->getRecords());
+ return &(*AllIntrinsics)[R];
----------------
arsenm wrote:
Why does this need its own special instance of the map?
https://github.com/llvm/llvm-project/pull/107100
More information about the llvm-commits
mailing list