[PATCH] D39345: SCEV: preserve debug information attached to PHI nodes.
Adrian Prantl via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 31 11:12:30 PDT 2017
aprantl added a comment.
I moved the logic over to `indvars` now, and that seems to fit naturally into `WidenIV::createWideIV()` with about the same functionality as above.
But I'm having trouble generating more interesting testcases. For example: The top-level comment in IndVarSimplify claims that the pass would
// 1. The exit condition for the loop is canonicalized to compare the
// induction value against the exit value. This turns loops like:
// 'for (i = 7; i*i < 1000; ++i)' into 'for (i = 0; i != 25; ++i)'
But I can't reproduce this:
char *a;
void f(int j) {
for (int i = 7; i*i < 1000; i+=1)
a[i] = i;
}
clang -O3 -c -S -emit-llvm -o - /tmp/loop.c -fno-unroll-loops -mllvm -print-after-all -g 2>&1
*** IR Dump After Induction Variable Simplification ***
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ 7, %entry ], [ %indvars.iv.next, %for.body ]
Has the functionality bitrotted, or is the comment out-of-date, or is there now a different transformation that would rewrite a loop like int that comment? Or can I change my testcase somehow?
I then put an assert that IVDiff (the diff between SCEV for the old and new phi in WidenIV::createWideIV()) is not a constant zero and check-llvm-transform still passes. That's not the end of the world, handling the constant-zero case would already be a nice improvement, but I'm wondering if I'm missing the big picture here.
https://reviews.llvm.org/D39345
More information about the llvm-commits
mailing list