[llvm] [LV] Optimise code created by createElementCount (PR #216981)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 19 02:40:25 PDT 2026


================
@@ -375,15 +375,16 @@ class VPBuilder {
 
   VPValue *createElementCount(Type *Ty, ElementCount EC) {
     VPlan &Plan = getPlan();
-    VPValue *RuntimeEC = Plan.getConstantInt(Ty, EC.getKnownMinValue());
     if (EC.isScalable()) {
       VPValue *VScale = createVScale(Ty);
-      RuntimeEC = EC.getKnownMinValue() == 1
-                      ? VScale
-                      : createOverflowingOp(Instruction::Mul,
-                                            {VScale, RuntimeEC}, {true, false});
+      if (EC.getKnownMinValue() == 1)
+        return VScale;
+      assert(isPowerOf2_32(EC.getKnownMinValue()));
----------------
david-arm wrote:

I think I actually have to do that because of another patch I recently landed. :)

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


More information about the llvm-commits mailing list