[llvm] [ThinLTO] optimize propagateAttributes performance (PR #132917)
Zhaoxuan Jiang via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 8 02:47:37 PDT 2025
https://github.com/nocchijiang updated https://github.com/llvm/llvm-project/pull/132917
>From 87f2f663e4d7c16c9115142b2a9ffe6e2dd60e22 Mon Sep 17 00:00:00 2001
From: Zhaoxuan Jiang <jiangzhaoxuan94 at gmail.com>
Date: Tue, 8 Apr 2025 16:34:32 +0800
Subject: [PATCH] [ThinLTO] optimize propagateAttributes performance
ModuleSummaryIndex::propagateAttributes() was observed to take about 25
minutes to complete on a ThinLTO application. Profiling revealed that
the majority of this time was spent operating on the
MarkedNonReadWriteOnly set.
By improving the hashing quality for ValueInfo, the execution time is
dramatically reduced to less than 10 seconds.
---
llvm/include/llvm/IR/ModuleSummaryIndex.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h b/llvm/include/llvm/IR/ModuleSummaryIndex.h
index 2650456c49841..7aa36345268cd 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndex.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h
@@ -300,7 +300,7 @@ template <> struct DenseMapInfo<ValueInfo> {
assert(isSpecialKey(L) || isSpecialKey(R) || (L.haveGVs() == R.haveGVs()));
return L.getRef() == R.getRef();
}
- static unsigned getHashValue(ValueInfo I) { return (uintptr_t)I.getRef(); }
+ static unsigned getHashValue(ValueInfo I) { return hash_value(I.getRef()); }
};
// For optional hinted size reporting, holds a pair of the full stack id
More information about the llvm-commits
mailing list