[llvm] Reapply "[LICM] Fold associative binary ops to promote code hoisting (#81608)" (PR #100377)

Ricardo Jesus via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 26 09:17:09 PDT 2024


rj-jesus wrote:

Hi @dtcxzyw 

Thanks for reporting this. I can't seem to reproduce the performance regression on `SingleSource/Benchmarks/Stanford/Queens` but do see a 5% increase in `SingleSource/Benchmarks/Misc/himenobmtxpa` and some increases in code size.

I think this can be addressed by bailing out early if `BO0->getNumUses() > 2`. This avoids cases where the intermediate op we are trying to avoid has many uses, and so performing the fold and hoist will likely not be beneficial or lead to a significant increase in code size. This seems to be what's happening with `himenobmtxpa`.

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


More information about the llvm-commits mailing list