mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
ABI breaking changes fixes.
This commit mostly just replaces bad uses of `NDEBUG` with uses of `LLVM_ENABLE_ABI_BREAKING_CHANGES` - the safe way to include ABI breaking changes (normally extra struct elements in headers). Differential Revision: https://reviews.llvm.org/D104216
This commit is contained in:
parent
586aaeabf1
commit
8521aa2a65
@ -145,7 +145,7 @@ public:
|
||||
FunctionAnalysisManager::Invalidator &);
|
||||
};
|
||||
|
||||
#ifndef NDEBUG
|
||||
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||
SmallVector<StringRef, 8> PassStack;
|
||||
#endif
|
||||
|
||||
|
@ -643,7 +643,7 @@ struct SemiNCAInfo {
|
||||
Bucket;
|
||||
SmallDenseSet<TreeNodePtr, 8> Visited;
|
||||
SmallVector<TreeNodePtr, 8> Affected;
|
||||
#ifndef NDEBUG
|
||||
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||
SmallVector<TreeNodePtr, 8> VisitedUnaffected;
|
||||
#endif
|
||||
};
|
||||
@ -852,7 +852,7 @@ struct SemiNCAInfo {
|
||||
TN->setIDom(NCD);
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||
for (const TreeNodePtr TN : II.VisitedUnaffected)
|
||||
assert(TN->getLevel() == TN->getIDom()->getLevel() + 1 &&
|
||||
"TN should have been updated by an affected ancestor");
|
||||
@ -918,7 +918,7 @@ struct SemiNCAInfo {
|
||||
LLVM_DEBUG(dbgs() << "Deleting edge " << BlockNamePrinter(From) << " -> "
|
||||
<< BlockNamePrinter(To) << "\n");
|
||||
|
||||
#ifndef NDEBUG
|
||||
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||
// Ensure that the edge was in fact deleted from the CFG before informing
|
||||
// the DomTree about it.
|
||||
// The check is O(N), so run it only in debug configuration.
|
||||
|
@ -85,7 +85,7 @@ class JumpThreadingPass : public PassInfoMixin<JumpThreadingPass> {
|
||||
std::unique_ptr<BranchProbabilityInfo> BPI;
|
||||
bool HasProfileData = false;
|
||||
bool HasGuards = false;
|
||||
#ifdef NDEBUG
|
||||
#ifndef LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||
SmallPtrSet<const BasicBlock *, 16> LoopHeaders;
|
||||
#else
|
||||
SmallSet<AssertingVH<const BasicBlock>, 16> LoopHeaders;
|
||||
|
@ -269,7 +269,7 @@ public:
|
||||
}
|
||||
|
||||
void setParentLoop(Loop *L) {
|
||||
#ifndef NDEBUG
|
||||
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||
ParentL = L;
|
||||
#endif
|
||||
}
|
||||
@ -308,7 +308,7 @@ public:
|
||||
/// loops within them will be visited in postorder as usual for the loop pass
|
||||
/// manager.
|
||||
void addSiblingLoops(ArrayRef<Loop *> NewSibLoops) {
|
||||
#ifndef NDEBUG
|
||||
#if defined(LLVM_ENABLE_ABI_BREAKING_CHECKS) && !defined(NDEBUG)
|
||||
for (Loop *NewL : NewSibLoops)
|
||||
assert(NewL->getParentLoop() == ParentL &&
|
||||
"All of the new loops must be siblings of the current loop!");
|
||||
@ -349,7 +349,7 @@ private:
|
||||
bool SkipCurrentLoop;
|
||||
const bool LoopNestMode;
|
||||
|
||||
#ifndef NDEBUG
|
||||
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||
// In debug builds we also track the parent loop to implement asserts even in
|
||||
// the face of loop deletion.
|
||||
Loop *ParentL;
|
||||
|
@ -160,7 +160,7 @@ class SCEVExpander : public SCEVVisitor<SCEVExpander, Value *> {
|
||||
/// consistent when instructions are moved.
|
||||
SmallVector<SCEVInsertPointGuard *, 8> InsertPointGuards;
|
||||
|
||||
#ifndef NDEBUG
|
||||
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||
const char *DebugType;
|
||||
#endif
|
||||
|
||||
@ -176,7 +176,7 @@ public:
|
||||
Builder(se.getContext(), TargetFolder(DL),
|
||||
IRBuilderCallbackInserter(
|
||||
[this](Instruction *I) { rememberInstruction(I); })) {
|
||||
#ifndef NDEBUG
|
||||
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||
DebugType = "";
|
||||
#endif
|
||||
}
|
||||
@ -186,7 +186,7 @@ public:
|
||||
assert(InsertPointGuards.empty());
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||
void setDebugType(const char *s) { DebugType = s; }
|
||||
#endif
|
||||
|
||||
|
@ -1086,7 +1086,9 @@ void PreservedCFGCheckerInstrumentation::registerCallbacks(
|
||||
|
||||
PIC.registerBeforeNonSkippedPassCallback(
|
||||
[this, &FAM](StringRef P, Any IR) {
|
||||
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||
assert(&PassStack.emplace_back(P));
|
||||
#endif
|
||||
(void)this;
|
||||
if (!any_isa<const Function *>(IR))
|
||||
return;
|
||||
@ -1098,16 +1100,20 @@ void PreservedCFGCheckerInstrumentation::registerCallbacks(
|
||||
|
||||
PIC.registerAfterPassInvalidatedCallback(
|
||||
[this](StringRef P, const PreservedAnalyses &PassPA) {
|
||||
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||
assert(PassStack.pop_back_val() == P &&
|
||||
"Before and After callbacks must correspond");
|
||||
#endif
|
||||
(void)this;
|
||||
});
|
||||
|
||||
PIC.registerAfterPassCallback([this, &FAM,
|
||||
checkCFG](StringRef P, Any IR,
|
||||
const PreservedAnalyses &PassPA) {
|
||||
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||
assert(PassStack.pop_back_val() == P &&
|
||||
"Before and After callbacks must correspond");
|
||||
#endif
|
||||
(void)this;
|
||||
|
||||
if (!any_isa<const Function *>(IR))
|
||||
|
@ -29,6 +29,12 @@
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Transforms/Utils/LoopUtils.h"
|
||||
|
||||
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||
#define SCEV_DEBUG_WITH_TYPE(TYPE, X) DEBUG_WITH_TYPE(TYPE, X)
|
||||
#else
|
||||
#define SCEV_DEBUG_WITH_TYPE(TYPE, X)
|
||||
#endif
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
cl::opt<unsigned> llvm::SCEVCheapExpansionBudget(
|
||||
@ -1225,7 +1231,7 @@ SCEVExpander::getAddRecExprPHILiterally(const SCEVAddRecExpr *Normalized,
|
||||
// We should not look for a incomplete PHI. Getting SCEV for a incomplete
|
||||
// PHI has no meaning at all.
|
||||
if (!PN.isComplete()) {
|
||||
DEBUG_WITH_TYPE(
|
||||
SCEV_DEBUG_WITH_TYPE(
|
||||
DebugType, dbgs() << "One incomplete PHI is found: " << PN << "\n");
|
||||
continue;
|
||||
}
|
||||
@ -2086,8 +2092,9 @@ SCEVExpander::replaceCongruentIVs(Loop *L, const DominatorTree *DT,
|
||||
Phi->replaceAllUsesWith(V);
|
||||
DeadInsts.emplace_back(Phi);
|
||||
++NumElim;
|
||||
DEBUG_WITH_TYPE(DebugType, dbgs()
|
||||
<< "INDVARS: Eliminated constant iv: " << *Phi << '\n');
|
||||
SCEV_DEBUG_WITH_TYPE(DebugType,
|
||||
dbgs() << "INDVARS: Eliminated constant iv: " << *Phi
|
||||
<< '\n');
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -2144,8 +2151,8 @@ SCEVExpander::replaceCongruentIVs(Loop *L, const DominatorTree *DT,
|
||||
TruncExpr == SE.getSCEV(IsomorphicInc) &&
|
||||
SE.LI.replacementPreservesLCSSAForm(IsomorphicInc, OrigInc) &&
|
||||
hoistIVInc(OrigInc, IsomorphicInc)) {
|
||||
DEBUG_WITH_TYPE(DebugType,
|
||||
dbgs() << "INDVARS: Eliminated congruent iv.inc: "
|
||||
SCEV_DEBUG_WITH_TYPE(
|
||||
DebugType, dbgs() << "INDVARS: Eliminated congruent iv.inc: "
|
||||
<< *IsomorphicInc << '\n');
|
||||
Value *NewInc = OrigInc;
|
||||
if (OrigInc->getType() != IsomorphicInc->getType()) {
|
||||
@ -2165,10 +2172,11 @@ SCEVExpander::replaceCongruentIVs(Loop *L, const DominatorTree *DT,
|
||||
}
|
||||
}
|
||||
}
|
||||
DEBUG_WITH_TYPE(DebugType, dbgs() << "INDVARS: Eliminated congruent iv: "
|
||||
<< *Phi << '\n');
|
||||
DEBUG_WITH_TYPE(DebugType, dbgs() << "INDVARS: Original iv: "
|
||||
<< *OrigPhiRef << '\n');
|
||||
SCEV_DEBUG_WITH_TYPE(DebugType,
|
||||
dbgs() << "INDVARS: Eliminated congruent iv: " << *Phi
|
||||
<< '\n');
|
||||
SCEV_DEBUG_WITH_TYPE(
|
||||
DebugType, dbgs() << "INDVARS: Original iv: " << *OrigPhiRef << '\n');
|
||||
++NumElim;
|
||||
Value *NewIV = OrigPhiRef;
|
||||
if (OrigPhiRef->getType() != Phi->getType()) {
|
||||
|
Loading…
Reference in New Issue
Block a user