Skip to content

Commit 6d85de8

Browse files
authored
[KeyInstr] Hide new MDNodeKeyImpl<DILocation> fields (#138296)
Follow up to llvm/llvm-project#133477. This prevents a compile time regression pointed out by nikic The additional checks in the methods seem to cause most of the regression (rather than being a consequence of increased size due to the fields themselves). The additional ifdefs are somewhat ugly, but will eventually be removed.
1 parent 562a455 commit 6d85de8

File tree

1 file changed

+30
-7
lines changed

1 file changed

+30
-7
lines changed

llvm/lib/IR/LLVMContextImpl.h

+30-7
Original file line numberDiff line numberDiff line change
@@ -315,30 +315,53 @@ template <> struct MDNodeKeyImpl<DILocation> {
315315
Metadata *Scope;
316316
Metadata *InlinedAt;
317317
bool ImplicitCode;
318+
#ifdef EXPERIMENTAL_KEY_INSTRUCTIONS
318319
uint64_t AtomGroup : 61;
319320
uint64_t AtomRank : 3;
321+
#endif
320322

321323
MDNodeKeyImpl(unsigned Line, unsigned Column, Metadata *Scope,
322324
Metadata *InlinedAt, bool ImplicitCode, uint64_t AtomGroup,
323325
uint8_t AtomRank)
324326
: Line(Line), Column(Column), Scope(Scope), InlinedAt(InlinedAt),
325-
ImplicitCode(ImplicitCode), AtomGroup(AtomGroup), AtomRank(AtomRank) {}
327+
ImplicitCode(ImplicitCode)
328+
#ifdef EXPERIMENTAL_KEY_INSTRUCTIONS
329+
,
330+
AtomGroup(AtomGroup), AtomRank(AtomRank)
331+
#endif
332+
{
333+
}
326334

327335
MDNodeKeyImpl(const DILocation *L)
328336
: Line(L->getLine()), Column(L->getColumn()), Scope(L->getRawScope()),
329-
InlinedAt(L->getRawInlinedAt()), ImplicitCode(L->isImplicitCode()),
330-
AtomGroup(L->getAtomGroup()), AtomRank(L->getAtomRank()) {}
337+
InlinedAt(L->getRawInlinedAt()), ImplicitCode(L->isImplicitCode())
338+
#ifdef EXPERIMENTAL_KEY_INSTRUCTIONS
339+
,
340+
AtomGroup(L->getAtomGroup()), AtomRank(L->getAtomRank())
341+
#endif
342+
{
343+
}
331344

332345
bool isKeyOf(const DILocation *RHS) const {
333346
return Line == RHS->getLine() && Column == RHS->getColumn() &&
334347
Scope == RHS->getRawScope() && InlinedAt == RHS->getRawInlinedAt() &&
335-
ImplicitCode == RHS->isImplicitCode() &&
336-
AtomGroup == RHS->getAtomGroup() && AtomRank == RHS->getAtomRank();
348+
ImplicitCode == RHS->isImplicitCode()
349+
#ifdef EXPERIMENTAL_KEY_INSTRUCTIONS
350+
&& AtomGroup == RHS->getAtomGroup() &&
351+
AtomRank == RHS->getAtomRank();
352+
#else
353+
;
354+
#endif
337355
}
338356

339357
unsigned getHashValue() const {
340-
return hash_combine(Line, Column, Scope, InlinedAt, ImplicitCode, AtomGroup,
341-
(uint8_t)AtomRank);
358+
return hash_combine(Line, Column, Scope, InlinedAt, ImplicitCode
359+
#ifdef EXPERIMENTAL_KEY_INSTRUCTIONS
360+
,
361+
AtomGroup, (uint8_t)AtomRank);
362+
#else
363+
);
364+
#endif
342365
}
343366
};
344367

0 commit comments

Comments
 (0)