Skip to content

Reland "MTM: fix issues after cursory reading" #101191

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

Closed
wants to merge 1 commit into from

Conversation

artagnon
Copy link
Contributor

Change: Using ArrayRef{} constructor syntax causes a build failure on gcc-7. Hence, revert instances of this change.

Change: Using ArrayRef{} constructor syntax causes a build failure on
gcc-7. Hence, revert instances of this change.
@artagnon artagnon requested review from nikic and joker-eph July 30, 2024 14:11
@s-barannikov
Copy link
Contributor

(passing by) What issues does it fix? I only see questionable style changes.

@artagnon
Copy link
Contributor Author

(passing by) What issues does it fix? I only see questionable style changes.

See #100404 for the original discussion: I initially marked it as a style change, but a reviewer requested dropping the NFC tag.

Copy link
Contributor

@s-barannikov s-barannikov left a comment

Choose a reason for hiding this comment

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

The renaming part is fine, but the rest of the changes look more personal prefernce than an attempt to conform to the coding standard.
Feel free to ignore my nitpicks if you get an approval. The history has already been clobbered anyway.

@@ -133,7 +127,7 @@ MachineTraceMetrics::getResources(const MachineBasicBlock *MBB) {

// Scale the resource cycles so they are comparable.
unsigned PROffset = MBB->getNumber() * PRKinds;
for (unsigned K = 0; K != PRKinds; ++K)
for (unsigned K = 0; K < PRKinds; ++K)
Copy link
Contributor

Choose a reason for hiding this comment

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

The coding standard doesn't specify which style of control condition is preferred, so there is no reason to change this line.

@@ -546,7 +540,7 @@ MachineTraceMetrics::Ensemble::invalidate(const MachineBasicBlock *BadMBB) {
if (BadTBI.hasValidHeight()) {
BadTBI.invalidateHeight();
WorkList.push_back(BadMBB);
do {
while (!WorkList.empty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

No reason to change this either, especially when it is clear that the container is non-empty on entry.

@@ -605,7 +599,7 @@ void MachineTraceMetrics::Ensemble::verify() const {
#ifndef NDEBUG
assert(BlockInfo.size() == MTM.MF->getNumBlockIDs() &&
"Outdated BlockInfo size");
for (unsigned Num = 0, e = BlockInfo.size(); Num != e; ++Num) {
for (unsigned Num = 0; Num < BlockInfo.size(); ++Num) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The left form is preferred.

std::tie(I, New) = Heights.insert(std::make_pair(Dep.DefMI, UseHeight));
if (New)
const auto &[I, Inserted] = Heights.insert({Dep.DefMI, UseHeight});
if (Inserted)
Copy link
Contributor

Choose a reason for hiding this comment

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

The coding standard says nothing about structured bindings. But it says something about auto -- that using it is discouraged, unless it clearly improves readability.

@artagnon
Copy link
Contributor Author

Not pursuing this.

@artagnon artagnon closed this Aug 19, 2024
@artagnon artagnon deleted the mtm-nfc-reland branch August 19, 2024 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants