Skip to content
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

[NFC] Use references to avoid copying #110462

Closed
wants to merge 8 commits into from
Closed
4 changes: 2 additions & 2 deletions llvm/utils/TableGen/IntrinsicEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ void IntrinsicEmitter::EmitIntrinsicToOverloadTable(
static constexpr uint8_t OTable[] = {
0
)";
for (auto [I, Int] : enumerate(Ints)) {
for (const auto [I, Int] : enumerate(Ints)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given it is just a copy, do we still need const?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed const

// Add one to the index so we emit a null bit for the invalid #0 intrinsic.
size_t Idx = I + 1;

Expand Down Expand Up @@ -346,7 +346,7 @@ static constexpr {} IIT_Table[] = {{
FixedEncodingTypeName);

unsigned MaxOffset = 0;
for (auto [Idx, FixedEncoding, Int] : enumerate(FixedEncodings, Ints)) {
for (const auto [Idx, FixedEncoding, Int] : enumerate(FixedEncodings, Ints)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why leaving const here. I had a quick search. const auto [ is much smaller used in LLVM code base.

$ grep -r 'const auto \[' llvm/| wc
     37     275    3760
$ grep -r 'auto \[' llvm/| wc
    817    5871   82133

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. It seems that we wont need to change anything in this PR. Closing this.

if ((Idx & 7) == 7)
OS << "\n ";

Expand Down
Loading