summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/IPO/Attributor.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index ebe4fba0856..a6e8e528fd0 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -107,6 +107,10 @@ static cl::opt<unsigned>
MaxFixpointIterations("attributor-max-iterations", cl::Hidden,
cl::desc("Maximal number of fixpoint iterations."),
cl::init(32));
+static cl::opt<bool> VerifyMaxFixpointIterations(
+ "attributor-max-iterations-verify", cl::Hidden,
+ cl::desc("Verify that max-iterations is a tight bound for a fixpoint"),
+ cl::init(false));
static cl::opt<bool> DisableAttributor(
"attributor-disable", cl::Hidden,
@@ -2509,6 +2513,10 @@ ChangeStatus Attributor::run() {
Worklist.insert(QuerriedAAs.begin(), QuerriedAAs.end());
}
+ LLVM_DEBUG(dbgs() << "[Attributor] #Iteration: " << IterationCounter
+ << ", Worklist+Dependent size: " << Worklist.size()
+ << "\n");
+
// Reset the changed set.
ChangedAAs.clear();
@@ -2529,7 +2537,7 @@ ChangeStatus Attributor::run() {
Worklist.clear();
Worklist.insert(ChangedAAs.begin(), ChangedAAs.end());
- } while (!Worklist.empty() && ++IterationCounter < MaxFixpointIterations);
+ } while (!Worklist.empty() && IterationCounter++ < MaxFixpointIterations);
size_t NumFinalAAs = AllAbstractAttributes.size();
@@ -2537,6 +2545,10 @@ ChangeStatus Attributor::run() {
<< IterationCounter << "/" << MaxFixpointIterations
<< " iterations\n");
+ if (VerifyMaxFixpointIterations && IterationCounter != MaxFixpointIterations)
+ llvm_unreachable("The fixpoint was not reached with exactly the number of "
+ "specified iterations!");
+
bool FinishedAtFixpoint = Worklist.empty();
// Reset abstract arguments not settled in a sound fixpoint by now. This
OpenPOWER on IntegriCloud