[clang] [llvm] [IndVarSimplify] Sink unused l-invariant loads in preheader. (PR #157559)

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 9 03:47:19 PDT 2025


https://github.com/nikic requested changes to this pull request.

I don't think IndVarSimplify is a good place to perform this transform. We could probably do this in LICM, which has access to MemorySSA. (LICM already sinks instructions from the loop to the exits, so doing it fore the preheader would be a somewhat natural extension of the scope of the pass.)

It looks like the current patch miscompiles clang (stage2 build crashes on llvm-test-suite).

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


More information about the cfe-commits mailing list