-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[KeyInstr] Fix DILocation AtomGroup/Rank bitfield packing for MSVC #138292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
As @nikic pointed out: We need to use uint64_t for both fields to get actual bit packing with msvc (https://c.godbolt.org/z/1f556c1zb). The cast to u8 in hash_combine prevents an increase in compile time (+0.16% for stage1-O0-g on compile-time-tracker).
@llvm/pr-subscribers-debuginfo @llvm/pr-subscribers-llvm-ir Author: Orlando Cazalet-Hyams (OCHyams) ChangesFollow up to #133477. As @nikic pointed out: We need to use uint64_t for both fields to get actual bit packing with msvc (https://c.godbolt.org/z/1f556c1zb). The cast to u8 in hash_combine prevents an increase in compile time (+0.16% for stage1-O0-g on compile-time-tracker). Full diff: https://github.com/llvm/llvm-project/pull/138292.diff 2 Files Affected:
diff --git a/llvm/include/llvm/IR/DebugInfoMetadata.h b/llvm/include/llvm/IR/DebugInfoMetadata.h
index 91cda271f498b..0f6a206cab75f 100644
--- a/llvm/include/llvm/IR/DebugInfoMetadata.h
+++ b/llvm/include/llvm/IR/DebugInfoMetadata.h
@@ -2237,7 +2237,7 @@ class DILocation : public MDNode {
friend class MDNode;
#ifdef EXPERIMENTAL_KEY_INSTRUCTIONS
uint64_t AtomGroup : 61;
- uint8_t AtomRank : 3;
+ uint64_t AtomRank : 3;
#endif
DILocation(LLVMContext &C, StorageType Storage, unsigned Line,
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index ad5fb802029fe..7b2ff6cf80972 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -316,7 +316,7 @@ template <> struct MDNodeKeyImpl<DILocation> {
Metadata *InlinedAt;
bool ImplicitCode;
uint64_t AtomGroup : 61;
- uint8_t AtomRank : 3;
+ uint64_t AtomRank : 3;
MDNodeKeyImpl(unsigned Line, unsigned Column, Metadata *Scope,
Metadata *InlinedAt, bool ImplicitCode, uint64_t AtomGroup,
@@ -338,7 +338,7 @@ template <> struct MDNodeKeyImpl<DILocation> {
unsigned getHashValue() const {
return hash_combine(Line, Column, Scope, InlinedAt, ImplicitCode, AtomGroup,
- AtomRank);
+ (uint8_t)AtomRank);
}
};
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…lvm#138292) Follow up to llvm#133477. As nikic pointed out: We need to use uint64_t for both fields to get actual bit packing with msvc (https://c.godbolt.org/z/1f556c1zb). The cast to u8 in hash_combine prevents an increase in compile time (+0.16% for stage1-O0-g on compile-time-tracker).
…lvm#138292) Follow up to llvm#133477. As nikic pointed out: We need to use uint64_t for both fields to get actual bit packing with msvc (https://c.godbolt.org/z/1f556c1zb). The cast to u8 in hash_combine prevents an increase in compile time (+0.16% for stage1-O0-g on compile-time-tracker).
…lvm#138292) Follow up to llvm#133477. As nikic pointed out: We need to use uint64_t for both fields to get actual bit packing with msvc (https://c.godbolt.org/z/1f556c1zb). The cast to u8 in hash_combine prevents an increase in compile time (+0.16% for stage1-O0-g on compile-time-tracker).
Follow up to #133477.
As nikic pointed out: We need to use uint64_t for both fields to get actual bit packing with msvc (https://c.godbolt.org/z/1f556c1zb).
The cast to u8 in hash_combine prevents an increase in compile time (+0.16% for stage1-O0-g on compile-time-tracker).