diff options
| author | Johannes Doerfert <jdoerfert@anl.gov> | 2019-08-26 18:55:47 +0000 | 
|---|---|---|
| committer | Johannes Doerfert <jdoerfert@anl.gov> | 2019-08-26 18:55:47 +0000 | 
| commit | b504eb8bb5ed952533a4fbb113e5a63ba6fd859d (patch) | |
| tree | 564eba3061edd8cae15f5be880723031ab393853 /llvm/lib | |
| parent | 4d3a3366129ab97d00efa9943e34ae75802330d8 (diff) | |
| download | bcm5719-llvm-b504eb8bb5ed952533a4fbb113e5a63ba6fd859d.tar.gz bcm5719-llvm-b504eb8bb5ed952533a4fbb113e5a63ba6fd859d.zip | |
[Attributor] Adjust and test the iteration bound of tests
Summary:
Try to verify how many iterations we need for a fixpoint in our tests.
This patch adjust the way we count to make it easier to follow. It also
adjusts the bounds to actually account for a fixpoint and not only the
minimum number to pass all checks.
Reviewers: uenoku, sstefan1
Subscribers: hiraditya, bollu, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66757
llvm-svn: 369945
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/IPO/Attributor.cpp | 14 | 
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 | 

