[llvm] [RISCV] Run EarlyMachineLICM before VLOptimizer to hoist constant splats (PR #210028)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 20 22:59:07 PDT 2026


================
@@ -623,8 +623,10 @@ void RISCVPassConfig::addPreEmitPass2() {
 void RISCVPassConfig::addMachineSSAOptimization() {
   // It's beneficial to reduce the VL to enable more
   // Machine SSA optimizations.
-  if (TM->getOptLevel() != CodeGenOptLevel::None)
+  if (TM->getOptLevel() != CodeGenOptLevel::None) {
+    addPass(&EarlyMachineLICMID);
----------------
lukel97 wrote:

Added a note in d526d81c96aaa6198c08f3adb00f35e01bfdd39f

> I wonder some of the compile time impact is from the additional work of hoisting these now hoist-able instructions?

With the dont-reduce-loop-invariant-pseudo-vl approach, potentially. But given the regressions w/ vsetvli toggles I don't think it's workable to begin with

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


More information about the llvm-commits mailing list