llvm-project
a4e48b5d - [LoopFusion] Simplify the logic of checking trip count equality (NFCI). (#201446)

Commit
2 days ago
[LoopFusion] Simplify the logic of checking trip count equality (NFCI). (#201446) Currently `haveIdenticalTripCounts` has a clunky return value, which makes it very easy to make a mistake. The returned pair doesn't provide much value and can be replaced with an optional integer. Also the function `haveIdenticalTripCounts` does more than what its name suggests. It checks whether peeling is supported for the pair of loops or not. Interestingly this is not the only place where we check whether peeling for this pair is supported! This patch changes the function and renames it to `calculateTripCountDiff`. It does exactly what the names says. It tries to calculate the difference of the trip counts of the two loops and if it fails it returns an empty optional. It is up to the caller to decide whether it wants to do fusion/peeling based on this result. The patch changes some debug output but no functional change is intended. Datatypes has been modified with explicit specification of size and signedness to avoid any bug due to overflow in subtraction or comparison of different integer types.
Author
Parents
Loading