[PATCH] Exit ScalarEvolution::getMulExpr Early when Choose Overflows
Andrew Trick
atrick at apple.com
Fri Aug 29 17:34:07 PDT 2014
Comments could be a little more clear.
================
Comment at: lib/Analysis/ScalarEvolution.cpp:2064-2070
@@ +2063,9 @@
+ // entering the loop by testing before the loop whether it will always
+ // overflow. Given that the loop below will compute:
+ // C(xe - 1, (xe - 1) / 2). Where:
+ // { xe = AddRec->getNumOperands() + OtherAddRec->getNumOperands() - 1 }
+ // and { OtherAddRec->getNumOperands() >= 0 } therefore:
+ // xe >= AddRec->getNumOperands() - 1
+ // Subsituting in the minimum xe:
+ // C(AddRec->getNumOperands() - 2, AddRec->getNumOperands() / 2 - 1)
+ // If Choose overflow for the expression above, then it will overflow in all
----------------
I think this comment needs to be clarified.
The loop actually computes up to C(xe - 1, xe - 1) right?
We just happen to know that the Choose function's maximum is at C(xe - 1, (xe - 1) / 2). Let's make that explicit.
http://reviews.llvm.org/D5113
More information about the llvm-commits
mailing list