[PATCH] D74691: [Attributor] Detect possibly unbounded cycles in functions
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 3 13:14:08 PST 2020
jdoerfert added a comment.
I haven't read all the comments but the code looks good with one problem, see below.
================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:2380
+ if (!SE || !LI)
+ NoAnalysis = true;
----------------
Nit: `bool NoAnalysis = !SE || !LI;`
================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:2394
+ Loop *L = LI->getLoopFor(BB);
+ if (L && !SE->getSmallConstantMaxTripCount(L))
+ return true;
----------------
```
if (!L || !SE->getSmallConstantMaxTripCount(L))
return true;
```
You ignore non-loop cycles otherwise. Please add a non-loop cycle test case, aka. irreducible control flow test case.
Here is a piece of C that should help create the test:
```
if (foo())
goto entry1;
else
goto entry2;
entry1:
if (foo())
goto exit;
else
goto entry2;
entry2:
if (foo())
goto exit;
else
goto entry1;
exit:
return;
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74691/new/
https://reviews.llvm.org/D74691
More information about the llvm-commits
mailing list