[llvm] [polly] [TableGen] Refactor Intrinsic handling in TableGen (PR #103980)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 14 14:34:46 PDT 2024


================
@@ -624,31 +594,34 @@ void IntrinsicEmitter::EmitAttributes(const CodeGenIntrinsicTable &Ints,
 
 void IntrinsicEmitter::EmitIntrinsicToBuiltinMap(
     const CodeGenIntrinsicTable &Ints, bool IsClang, raw_ostream &OS) {
-  StringRef CompilerName = (IsClang ? "Clang" : "MS");
-  StringRef UpperCompilerName = (IsClang ? "CLANG" : "MS");
-  typedef std::map<std::string, std::map<std::string, std::string>> BIMTy;
+  StringRef CompilerName = IsClang ? "Clang" : "MS";
+  StringRef UpperCompilerName = IsClang ? "CLANG" : "MS";
+  // map<TargetPrefix, map<BuiltinName, EnumName>>. Note that we iterate over
+  // both maps in the code below. For the inner map, entries need to be emitted
+  // in the sorted order of `BuiltinName` because we use std::lower_bound to
+  // search these entries. For the outer map, it doesn't need be be sorted, but
+  // we use a map to eliminate non-determinism in the emitted code.
----------------
jurahul wrote:

I had clang test failures due to an earlier version of this change that used DenseMap. I added this comment to explain why both the maps need to be ordered.

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


More information about the llvm-commits mailing list