This is an archive of the discontinued LLVM Phabricator instance.

[Clang][BinaryOperator] memoize ICEKind for BinaryOperator Exprs
Needs ReviewPublic

Authored by justinstitt on Aug 8 2022, 10:34 AM.

Details

Reviewers
nickdesaulniers
Summary

When building the Linux Kernel (x86_64) CheckICE is a particularly slow
method which results in 0.815% of all cpu cycles (~63 million cycles).
Much of this is due to repeat checks regarding the ICEKind of binary
expressions.

Storing ICEKind information within BinaryOperator and stopping future
CheckICE calls before they do repeat work shows a net speed increase of
~80% for CheckICE (~14 million cycles).

Diff Detail

Event Timeline

justinstitt created this revision.Aug 8 2022, 10:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 8 2022, 10:34 AM
justinstitt requested review of this revision.Aug 8 2022, 10:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 8 2022, 10:34 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
justinstitt edited the summary of this revision. (Show Details)
justinstitt added a reviewer: nickdesaulniers.
  • test adding reviewers
clang/include/clang/AST/Expr.h
30

Please keep the list of #includes alphabetically sorted.

3824

Let's keep additions before the comment block specific to BinaryOperator's definition.

3832

Let's make this private, initialize it to llvm::None (see llvm/include/llvm/ADT/None.h), then add getters and setters. They should accept/return ICEKind; basically, I don't think we should support un-setting the ICEKind once we know what it is.

Also, prefer ICEKind in C++; enum ICEKind is required only in C.

3837–3842

Move back.

clang/lib/AST/ExprConstant.cpp
15526

make this two lines?

$ git-clang-format HEAD~ should reformat this for you.

15527

remove

15750

undo

justinstitt marked 7 inline comments as done.

create getter/setter for optional ICEKind

update commit message

justinstitt retitled this revision from [Clang][BinaryOperator] cache ICEKind to [Clang][BinaryOperator] memoize ICEKind for BinaryOperator Exprs.
justinstitt edited the summary of this revision. (Show Details)

add profile data to commit message

barannikov88 added inline comments.
clang/include/clang/AST/Expr.h
3832

Does it need to be Optional? It seems that it is never checked that it does not hold a value except for the setter method.
An "invalid" enumeration member would serve well IMO.
Not a strong objection.

inclyc added a subscriber: inclyc.Aug 9 2022, 11:23 AM