[llvm-commits] ScalarEvolution fix for treeadd

Nick Lewycky nicholas at mxc.ca
Sat Jul 21 21:45:55 PDT 2007


Treeadd has a for loop from 0 to 100 that scalar-evolution isn't able to
determine the bounds of. Attached is a patch that handles the unusual
case where the exit branch indirectly leads back to the loop header.

It didn't cause any miscompiles in llvm-test (excl. External) and I did
a count of how many loops it was able to predict before and after this
patch:

Before:

predictable loop count: 4904 (21%)
not predictable: 18359       (79%)

After:

predictable loop count: 4679 (24%)
not predictable: 14877       (76%)

The total varies because the loop optimizations must request the loop
count from scalar evolution. It's not clear to me why -- perhaps the
loops were canonicalized earlier.

Nick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: scev-treeadd.patch
Type: text/x-diff
Size: 1364 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070722/072fbe70/attachment.patch>


More information about the llvm-commits mailing list