Currently, SCEV's cost model will always return the cost of a Multiply
for `scMulExpr`, without taking into account the cases where
`SCEVExpander::visitMulExpr` does not actually emit a multiply. This PR
addresses two of these cases:
- `-1 * X`: generates `sub 0, X`
- `2^k * X`: generates `shl X, k`
This mismatch matters on targets where integer multiply is expensive
because it can block runtime unrolling by overestimating the cost of
expanding the trip count calculation.
This patch checks the constant operand in two-operand `scMulExpr` and
counts it as a subtract if it is -1 or a shift-left if it is a power of
2.
The patch also introduces a new lit test, and udpates
`IndVarSimplify/X86/loop-invariant-conditions.ll` because it now
correctly estimates the cost of `-1 * start` which allows IndVarSimplify
to simplify the induction variable.
Assisted-by: Cursor (Claude)