[llvm] [LSR] Fix matching vscale immediates (PR #100080)
    Paul Walker via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Tue Jul 23 03:47:58 PDT 2024
    
    
  
================
@@ -947,7 +947,8 @@ static Immediate ExtractImmediate(const SCEV *&S, ScalarEvolution &SE) {
                            SCEV::FlagAnyWrap);
     return Result;
   } else if (EnableVScaleImmediates)
-    if (const SCEVMulExpr *M = dyn_cast<SCEVMulExpr>(S))
+    if (const SCEVMulExpr *M = dyn_cast<SCEVMulExpr>(S);
+        M && M->getNumOperands() == 2)
----------------
paulwalker-arm wrote:
Up to you but personally I think this would be cleaner and more consistent with the surrounding code if flipped like:
```
else if (const SCEVMulExpr *M = dyn_cast<SCEVMulExpr>(S))
  if (EnableVScaleImmediates && M->getNumOperands() == 2)
.....
````
```
https://github.com/llvm/llvm-project/pull/100080
    
    
More information about the llvm-commits
mailing list