Skip to content

Instantly share code, notes, and snippets.

@bjacob
Last active March 18, 2024 18:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjacob/ef04e138d571348edea0f5808c43fc3c to your computer and use it in GitHub Desktop.
Save bjacob/ef04e138d571348edea0f5808c43fc3c to your computer and use it in GitHub Desktop.
diff --git a/home/benoit/iree-build/llvm-project/tools/mlir/include/mlir/IR/BuiltinDialectBytecode.cpp.inc b/tmp/BuiltinDialectBytecode.cpp.inc
index 26072dbe9c8f..015598623db4 100644
--- a/home/benoit/iree-build/llvm-project/tools/mlir/include/mlir/IR/BuiltinDialectBytecode.cpp.inc
+++ b/tmp/BuiltinDialectBytecode.cpp.inc
@@ -355,6 +355,27 @@ static void write(UnknownLoc attribute, DialectBytecodeWriter &writer) {
writer.writeVarInt(/* UnknownLoc */ 15);
}
+namespace {
+struct Logger {
+ std::map<std::string, int> m;
+ Logger() {
+ }
+ ~Logger() {
+ for (const auto& p : m) {
+ fprintf(stderr, "%s,%d\n", p.first.c_str(), p.second);
+ }
+ }
+ void log(const std::string& s) {
+ ++m[s];
+ }
+};
+} // namespace
+
+Logger& LoggerSingleton() {
+ static Logger l;
+ return l;
+}
+
static Attribute readAttribute(MLIRContext* context, DialectBytecodeReader &reader) {
uint64_t kind;
if (failed(reader.readVarInt(kind)))
@@ -381,16 +402,21 @@ static Attribute readAttribute(MLIRContext* context, DialectBytecodeReader &read
case 9:
return readFloatAttr(context, reader);
case 10:
+ LoggerSingleton().log("CallSiteLoc");
return readCallSiteLoc(context, reader);
case 11:
+ LoggerSingleton().log("FileLineColLoc");
return readFileLineColLoc(context, reader);
case 12:
+ LoggerSingleton().log("FusedLoc");
return readFusedLoc(context, reader);
case 13:
+ LoggerSingleton().log("FusedLocWithMetadata");
return readFusedLocWithMetadata(context, reader);
case 14:
+ LoggerSingleton().log("NameLoc");
return readNameLoc(context, reader);
case 15:
+ LoggerSingleton().log("UnknownLoc");
return readUnknownLoc(context, reader);
case 16:
return readDenseResourceElementsAttr(context, reader);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment