Skip to content

Commit 963e079

Browse files
committed
[KeyInstr] Hide new MDNodeKeyImpl<DILocation> fields (llvm#138296)
Follow up to llvm#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 6ee5f03 commit 963e079

File tree

1 file changed

+30
-7
lines changed

1 file changed

+30
-7
lines changed

llvm/lib/IR/LLVMContextImpl.h

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -319,30 +319,53 @@ template <> struct MDNodeKeyImpl<DILocation> {
319319
Metadata *Scope;
320320
Metadata *InlinedAt;
321321
bool ImplicitCode;
322+
#ifdef EXPERIMENTAL_KEY_INSTRUCTIONS
322323
uint64_t AtomGroup : 61;
323324
uint64_t AtomRank : 3;
325+
#endif
324326

325327
MDNodeKeyImpl(unsigned Line, unsigned Column, Metadata *Scope,
326328
Metadata *InlinedAt, bool ImplicitCode, uint64_t AtomGroup,
327329
uint8_t AtomRank)
328330
: Line(Line), Column(Column), Scope(Scope), InlinedAt(InlinedAt),
329-
ImplicitCode(ImplicitCode), AtomGroup(AtomGroup), AtomRank(AtomRank) {}
331+
ImplicitCode(ImplicitCode)
332+
#ifdef EXPERIMENTAL_KEY_INSTRUCTIONS
333+
,
334+
AtomGroup(AtomGroup), AtomRank(AtomRank)
335+
#endif
336+
{
337+
}
330338

331339
MDNodeKeyImpl(const DILocation *L)
332340
: Line(L->getLine()), Column(L->getColumn()), Scope(L->getRawScope()),
333-
InlinedAt(L->getRawInlinedAt()), ImplicitCode(L->isImplicitCode()),
334-
AtomGroup(L->getAtomGroup()), AtomRank(L->getAtomRank()) {}
341+
InlinedAt(L->getRawInlinedAt()), ImplicitCode(L->isImplicitCode())
342+
#ifdef EXPERIMENTAL_KEY_INSTRUCTIONS
343+
,
344+
AtomGroup(L->getAtomGroup()), AtomRank(L->getAtomRank())
345+
#endif
346+
{
347+
}
335348

336349
bool isKeyOf(const DILocation *RHS) const {
337350
return Line == RHS->getLine() && Column == RHS->getColumn() &&
338351
Scope == RHS->getRawScope() && InlinedAt == RHS->getRawInlinedAt() &&
339-
ImplicitCode == RHS->isImplicitCode() &&
340-
AtomGroup == RHS->getAtomGroup() && AtomRank == RHS->getAtomRank();
352+
ImplicitCode == RHS->isImplicitCode()
353+
#ifdef EXPERIMENTAL_KEY_INSTRUCTIONS
354+
&& AtomGroup == RHS->getAtomGroup() &&
355+
AtomRank == RHS->getAtomRank();
356+
#else
357+
;
358+
#endif
341359
}
342360

343361
unsigned getHashValue() const {
344-
return hash_combine(Line, Column, Scope, InlinedAt, ImplicitCode, AtomGroup,
345-
(uint8_t)AtomRank);
362+
return hash_combine(Line, Column, Scope, InlinedAt, ImplicitCode
363+
#ifdef EXPERIMENTAL_KEY_INSTRUCTIONS
364+
,
365+
AtomGroup, (uint8_t)AtomRank);
366+
#else
367+
);
368+
#endif
346369
}
347370
};
348371

0 commit comments

Comments
 (0)