This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass
ClosedPublic

Authored by jsji on Dec 15 2020, 1:12 PM.

Details

Summary

The PPCCTRLoop pass has been moved to HardwareLoops,
so the comments and some useless code are deprecated now.

Diff Detail

Event Timeline

jsji created this revision.Dec 15 2020, 1:12 PM
jsji requested review of this revision.Dec 15 2020, 1:12 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 15 2020, 1:12 PM
jsji edited the summary of this revision. (Show Details)Dec 15 2020, 1:13 PM
jsji updated this revision to Diff 312025.Dec 15 2020, 2:15 PM

Fix the include as well.

Thanks for clean-up. Some minor comments.

llvm/lib/Target/PowerPC/PPCCTRLoops.cpp
16

Seems now we only need following headers:

#include "MCTargetDesc/PPCMCTargetDesc.h"
#include "PPC.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/Debug.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
43–44

Since now all the function body is guarded under #ifndef NDEBUG, should we guard other headers as well?

jsji updated this revision to Diff 312371.Dec 16 2020, 8:36 PM

Update the NDEBUG

llvm/lib/Target/PowerPC/PPCCTRLoops.cpp
16
The full include-list for /home/jji/llvm-project/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp:
#include <vector>                                     // for vector
#include "MCTargetDesc/PPCMCTargetDesc.h"             // for CTR, CTR8, BDNZ
#include "PPC.h"                                      // for createPPCCTRLoo...
#include "llvm/ADT/SmallSet.h"                        // for SmallSet
#include "llvm/ADT/SmallVector.h"                     // for SmallVector
#include "llvm/ADT/StringRef.h"                       // for StringRef
#include "llvm/ADT/ilist_iterator.h"                  // for operator!=, ope...
#include "llvm/CodeGen/MachineBasicBlock.h"           // for MachineBasicBlock
#include "llvm/CodeGen/MachineDominators.h"           // for MachineDominato...
#include "llvm/CodeGen/MachineFunction.h"             // for MachineFunction
#include "llvm/CodeGen/MachineFunctionPass.h"         // for MachineFunction...
#include "llvm/CodeGen/MachineInstr.h"                // for operator<<, Mac...
#include "llvm/CodeGen/MachineInstrBundleIterator.h"  // for MachineInstrBun...
#include "llvm/CodeGen/MachineOperand.h"              // for MachineOperand
#include "llvm/CodeGen/Register.h"                    // for Register
#include "llvm/InitializePasses.h"                    // for initializeMachi...
#include "llvm/Pass.h"                                // for AnalysisUsage
#include "llvm/PassRegistry.h"                        // for PassRegistry
#include "llvm/Support/CodeGen.h"                     // for llvm
#include "llvm/Support/Debug.h"  // lines 40-40
#include "llvm/Support/ErrorHandling.h"               // for llvm_unreachable
#include "llvm/Support/GenericDomTreeConstruction.h"  // for dbgs, LLVM_DEBUG
#include "llvm/Support/Printable.h"                   // for operator<<, Pri...
#include "llvm/Support/raw_ostream.h"                 // for raw_ostream
---

This is the output of include what you use, some of the include may have been included in some other headers, I would prefer we keep this as we may want to reduce some include in headers as well later.

LGTM.

llvm/lib/Target/PowerPC/PPCCTRLoops.cpp
11

Complete passes that are only defined for non-NDEBUG builds are rare and I think a comment should explain what is going on here. Something like:

CTR loops are produced by the HardwareLoops pass and this pass is simply a verification that no invalid CTR loops are produced. As such, it isn't something that needs to be run (or even defined) for Release builds so the entire file is guarded by NDEBUG.

nemanjai accepted this revision.Dec 17 2020, 3:17 AM
This revision is now accepted and ready to land.Dec 17 2020, 3:17 AM
jsji updated this revision to Diff 312488.Dec 17 2020, 7:11 AM

Add comments about NDEBUG

This revision was landed with ongoing or failed builds.Dec 17 2020, 8:16 AM
This revision was automatically updated to reflect the committed changes.