Issue 244471
Summary [LSR] Should BaselineCost be computed after collecting all uses and fixups?
Labels new issue
Assignees
Reporter ardenyang0125
    While investigating LSR profitability decisions, I noticed that
`BaselineCost` is computed inside `CollectFixupsAndInitialFormulae()`,
before all fixups are finalized and before
`CollectLoopInvariantFixupsAndFormulae()` collects supplemental uses.

The candidate costs are evaluated using the completed information.
This means the baseline and candidate may cover different accounting
scopes, even though both use `RateFormula`.

I proposed moving baseline cost calculation after both collection steps,
but before generating reuse formulas:

https://github.com/llvm/llvm-project/pull/243101

The PR includes regression tests demonstrating the accounting differences
and leaves the default solution-dropping policy unchanged.

Assisted-by: OpenAI Codex
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to