[PATCH] D71145: [InstCombine] Allow to limit the max number of iterations
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 9 07:09:47 PST 2019
spatel added reviewers: lebedev.ri, nikic, xbolva00.
spatel added a comment.
I like this idea. In addition to the stated uses, it can be used to improve debugging of what used to be infinite loops (see D71164 <https://reviews.llvm.org/D71164> as a current example).
I think you're right that this doesn't change current behavior because:
++Iteration;
if (Iteration > MaxIterations) {
...will silently overflow because we initialized the max to UINT_MAX. So an infinite loop will still be an infinite loop. But what if we instead initialize that to some lower constant (1000?) and then assert that we haven't hit LimitMaxIterations?
================
Comment at: llvm/test/Transforms/InstCombine/limit-max-iterations.ll:1
+; RUN: opt < %s -instcombine --instcombine-max-iterations=0 -S | FileCheck %s --check-prefix=ZERO
+; RUN: opt < %s -instcombine --instcombine-max-iterations=1 -S | FileCheck %s --check-prefix=ONE
----------------
This looks like you used utils/update_test_checks.py, but then made some manual edits? Was the script output not good in some way? If not, I prefer to leave the auto-generated output as-is for easier updating in the future.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71145/new/
https://reviews.llvm.org/D71145
More information about the llvm-commits
mailing list