https://bugs.freedesktop.org/show_bug.cgi?id=84232
--- Comment #10 from Vitaliy Filippov vitalif@yourcmc.ru --- I've managed to make a reduced test case with a recursive PHI after StructurizeCFG !!!
int main() { int i, j = 0; while (j % 2) { if (j > 100) j += 3; else if (j > 50) break; } return j; }
clang-3.5 -S -emit-llvm test3.c opt-3.5 -S -structurizecfg test3.ll > test3cfg.ll
Simple to visualise with graphviz:
( echo 'digraph G {'; perl -ne 'if (/%(\S+) = phi/) { my $a = $1; print "$a -> $_;\n" for /[ %([^\s,]+)/g; }' test3cfg.ll; echo '}' ) > test3cfg.dot dot -Tsvg test3cfg.dot > test3cfg.svg
%21 and %26 phi's loop in the result.
Also there is a branch on constant in the end of test3cfg.ll:
br i1 false, label %14, label %Flow2