forked from OSchip/llvm-project
Replace incorrect "#ifdef DEBUG" with "#ifndef NDEBUG".
The former is simply wrong -- the code will either never be used or will always be used, rather than being dependent upon whether it's built with debug assertions enabled. The macro DEBUG isn't ever set by the llvm build system. But, the macro DEBUG(X) is defined (unconditionally) if you happen to include llvm/Support/Debug.h. The code in Value.h which was erroneously protected by the #ifdef DEBUG didn't even compile -- you can't cast<> from an LLVMOpaqueValue directly. Fortunately, it was never invoked, as Core.cpp included Value.h before Debug.h. The conditionalized code in AArch64CollectLOH.cpp was previously always used, as it includes Debug.h. llvm-svn: 280056
This commit is contained in:
parent
c80f7b866e
commit
d7d9e1069b
|
@ -805,9 +805,9 @@ inline Value **unwrap(LLVMValueRef *Vals) {
|
|||
|
||||
template<typename T>
|
||||
inline T **unwrap(LLVMValueRef *Vals, unsigned Length) {
|
||||
#ifdef DEBUG
|
||||
#ifndef NDEBUG
|
||||
for (LLVMValueRef *I = Vals, *E = Vals + Length; I != E; ++I)
|
||||
cast<T>(*I);
|
||||
unwrap<T>(*I); // For side effect of calling assert on invalid usage.
|
||||
#endif
|
||||
(void)Length;
|
||||
return reinterpret_cast<T**>(Vals);
|
||||
|
|
|
@ -138,6 +138,7 @@ BasicBlockScopeOnly("aarch64-collect-loh-bb-only", cl::Hidden,
|
|||
|
||||
STATISTIC(NumADRPSimpleCandidate,
|
||||
"Number of simplifiable ADRP dominate by another");
|
||||
#ifndef NDEBUG
|
||||
STATISTIC(NumADRPComplexCandidate2,
|
||||
"Number of simplifiable ADRP reachable by 2 defs");
|
||||
STATISTIC(NumADRPComplexCandidate3,
|
||||
|
@ -156,11 +157,14 @@ STATISTIC(NumLDRToLDRWithImm,
|
|||
"Number of simplifiable LDR with imm reachable by LDR");
|
||||
STATISTIC(NumADDToLDR, "Number of simplifiable LDR reachable by ADD");
|
||||
STATISTIC(NumLDRToLDR, "Number of simplifiable LDR reachable by LDR");
|
||||
#endif // NDEBUG
|
||||
STATISTIC(NumADRPToLDR, "Number of simplifiable LDR reachable by ADRP");
|
||||
#ifndef NDEBUG
|
||||
STATISTIC(NumCplxLvl1, "Number of complex case of level 1");
|
||||
STATISTIC(NumTooCplxLvl1, "Number of too complex case of level 1");
|
||||
STATISTIC(NumCplxLvl2, "Number of complex case of level 2");
|
||||
STATISTIC(NumTooCplxLvl2, "Number of too complex case of level 2");
|
||||
#endif // NDEBUG
|
||||
STATISTIC(NumADRSimpleCandidate, "Number of simplifiable ADRP + ADD");
|
||||
STATISTIC(NumADRComplexCandidate, "Number of too complex ADRP + ADD");
|
||||
|
||||
|
@ -627,7 +631,7 @@ static void computeADRP(const InstrToInstrs &UseToDefs,
|
|||
AArch64FI.addLOHDirective(MCLOH_AdrpAdrp, {L2, L1});
|
||||
++NumADRPSimpleCandidate;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
#ifndef NDEBUG
|
||||
else if (Size == 2)
|
||||
++NumADRPComplexCandidate2;
|
||||
else if (Size == 3)
|
||||
|
@ -771,10 +775,10 @@ static void computeOthers(const InstrToInstrs &UseToDefs,
|
|||
AArch64FunctionInfo &AArch64FI, const MapRegToId &RegToId,
|
||||
const MachineDominatorTree *MDT) {
|
||||
SetOfMachineInstr *InvolvedInLOHs = nullptr;
|
||||
#ifdef DEBUG
|
||||
#ifndef NDEBUG
|
||||
SetOfMachineInstr InvolvedInLOHsStorage;
|
||||
InvolvedInLOHs = &InvolvedInLOHsStorage;
|
||||
#endif // DEBUG
|
||||
#endif // NDEBUG
|
||||
DEBUG(dbgs() << "*** Compute LOH for Others\n");
|
||||
// ADRP -> ADD/LDR -> LDR/STR pattern.
|
||||
// Fall back to ADRP -> ADD pattern if we fail to catch the bigger pattern.
|
||||
|
@ -815,7 +819,7 @@ static void computeOthers(const InstrToInstrs &UseToDefs,
|
|||
// PotentialCandidates are result of a chain ADRP -> ADD/LDR ->
|
||||
// A potential candidate becomes a candidate, if its current immediate
|
||||
// operand is zero and all nodes of the chain have respectively only one user
|
||||
#ifdef DEBUG
|
||||
#ifndef NDEBUG
|
||||
SetOfMachineInstr DefsOfPotentialCandidates;
|
||||
#endif
|
||||
for (const MachineInstr *Candidate : PotentialCandidates) {
|
||||
|
@ -831,7 +835,7 @@ static void computeOthers(const InstrToInstrs &UseToDefs,
|
|||
getUses(DefsPerColorToUses,
|
||||
RegToId.find(Def->getOperand(0).getReg())->second, *Def);
|
||||
if (Users->size() > 1) {
|
||||
#ifdef DEBUG
|
||||
#ifndef NDEBUG
|
||||
// if all the uses of this def are in potential candidate, this is
|
||||
// a complex candidate of level 2.
|
||||
bool IsLevel2 = true;
|
||||
|
@ -844,7 +848,7 @@ static void computeOthers(const InstrToInstrs &UseToDefs,
|
|||
}
|
||||
if (IsLevel2)
|
||||
++NumCplxLvl2;
|
||||
#endif // DEBUG
|
||||
#endif // NDEBUG
|
||||
PotentialADROpportunities.insert(Def);
|
||||
continue;
|
||||
}
|
||||
|
@ -859,7 +863,7 @@ static void computeOthers(const InstrToInstrs &UseToDefs,
|
|||
getUses(DefsPerColorToUses,
|
||||
RegToId.find(Def->getOperand(0).getReg())->second, *Def);
|
||||
if (Users->size() > 1) {
|
||||
#ifdef DEBUG
|
||||
#ifndef NDEBUG
|
||||
// if all the uses of this def are in the defs of the potential candidate,
|
||||
// this is a complex candidate of level 1
|
||||
if (DefsOfPotentialCandidates.empty()) {
|
||||
|
@ -881,7 +885,7 @@ static void computeOthers(const InstrToInstrs &UseToDefs,
|
|||
}
|
||||
if (!Found)
|
||||
++NumCplxLvl1;
|
||||
#endif // DEBUG
|
||||
#endif // NDEBUG
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -928,7 +932,7 @@ static void computeOthers(const InstrToInstrs &UseToDefs,
|
|||
"L2 already involved in LOH.");
|
||||
assert((!InvolvedInLOHs || InvolvedInLOHs->insert(Candidate)) &&
|
||||
"Candidate already involved in LOH.");
|
||||
#ifdef DEBUG
|
||||
#ifndef NDEBUG
|
||||
// get the immediate of the load
|
||||
if (Candidate->getOperand(2).getImm() == 0)
|
||||
if (ImmediateDefOpc == AArch64::ADDXri)
|
||||
|
@ -939,7 +943,7 @@ static void computeOthers(const InstrToInstrs &UseToDefs,
|
|||
++NumADDToLDRWithImm;
|
||||
else
|
||||
++NumLDRToLDRWithImm;
|
||||
#endif // DEBUG
|
||||
#endif // NDEBUG
|
||||
}
|
||||
} else {
|
||||
if (ImmediateDefOpc == AArch64::ADRP)
|
||||
|
@ -962,7 +966,7 @@ static void computeOthers(const InstrToInstrs &UseToDefs,
|
|||
"L2 already involved in LOH.");
|
||||
assert((!InvolvedInLOHs || InvolvedInLOHs->insert(Candidate)) &&
|
||||
"Candidate already involved in LOH.");
|
||||
#ifdef DEBUG
|
||||
#ifndef NDEBUG
|
||||
// get the immediate of the store
|
||||
if (Candidate->getOperand(2).getImm() == 0)
|
||||
if (ImmediateDefOpc == AArch64::ADDXri)
|
||||
|
|
Loading…
Reference in New Issue