In ScalarEvolutionExpander::isHighCostExpansion, the cost of an AddRecExpr is dependent upon the number of terms, which reflects the number of operations required. So this should also be done for normal Add and Mul Exprs too.
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
In D76434 you highlighted by SCEVNAry expressions can have more than two operands, which would expand to a chain of operations, and the existing costs for AddRecExprs tries to account for that. But this was missing for normal Add and Mul expressions. Have I misunderstood you?
clang-format: please reformat the code