[NewPM] Loop unswitch regression from legacy PM to new PM

Hello,

I’m upgrading from using the legacy pass manager to using the new pass manager, but I’m observing a regression around code that looks like broadcasting operations (see here: Compiler Explorer). Originally the broadcasted operations vectorize, but with the new pass manager they do not vectorize. I believe the issue comes down to the loop unswitching changes in the new pass manager, but I haven’t been able to persuade unswitching to occur even with large unswitch thresholds (–unswitch-threshold=100000). What options/flags can I use to recover the old unswitching/vectorization behavior with the new pass manager?

1 Like

Just for reference, that code also doesn’t vectorize with LLVM 16.

At first glance, maybe you’re running into the same issue as ⚙ D138526 [SimpleLoopUnswitch] unswitch selects ?