This is an archive of the discontinued LLVM Phabricator instance.

[NFC] Fix compile time regression seen on some benchmarks after a630ea3003 commit
ClosedPublic

Authored by yurai007 on Jul 11 2022, 12:14 AM.

Details

Summary

The goal of this change is fixing most of compile time slowdown seen after a630ea3003 commit on lencod and sqlite3 benchmarks.

There are 3 simple improvements included in this patch:

  1. In getNumOperands when possible get value directly from SmallNumOps.
  2. Inline getLargePtr by moving its definition to header.
  3. In TBAAStructTypeNode::getField get all operands once instead taking operands in loop one after one.

Diff Detail

Event Timeline

yurai007 created this revision.Jul 11 2022, 12:14 AM
yurai007 requested review of this revision.Jul 11 2022, 12:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 11 2022, 12:14 AM
yurai007 edited the summary of this revision. (Show Details)Jul 11 2022, 12:14 AM
nikic accepted this revision.Jul 11 2022, 1:17 AM
llvm/include/llvm/IR/Metadata.h
1045

Directly use getLarge().size() here?

llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
306

Can use Node->operands() here?

This revision is now accepted and ready to land.Jul 11 2022, 1:17 AM
yurai007 added inline comments.Jul 11 2022, 5:45 AM
llvm/include/llvm/IR/Metadata.h
1045

Right, it should be slightly better. There is no need to check IsLarge twice in slow path.

llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
306

Unfortunately not. I tried this initially, but there is no simple conversion from iterator_range<const llvm::MDOperand *> to MutableArrayRef/ArrayRef<llvm::MDOperand>. Also making Operands iterator_range complicates things with indexing and getting size so ended up with passing iterators directly to ArrayRef.

yurai007 updated this revision to Diff 443619.Jul 11 2022, 6:27 AM
yurai007 marked an inline comment as done.
dexonsmith added inline comments.Jul 11 2022, 12:41 PM
llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
306

As a prep / follow-up, it might be reasonable to update operands() to return ArrayRef.

yurai007 added inline comments.Jul 11 2022, 11:30 PM
llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
306

As a prep / follow-up, it might be reasonable to update operands() to return ArrayRef.

Ok. I can prepare such change as follow-up.

This revision was landed with ongoing or failed builds.Jul 12 2022, 6:02 AM
This revision was automatically updated to reflect the committed changes.