[llvm] [VPlan] Use nuw/nsw when computing {VF, VScale}xUF (PR #170710)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 8 01:39:31 PST 2025


================
@@ -4571,7 +4571,8 @@ void VPlanTransforms::materializeVFAndVFxUF(VPlan &Plan, VPBasicBlock *VectorPH,
   VF.replaceAllUsesWith(RuntimeVF);
 
   VPValue *UF = Plan.getConstantInt(TCTy, Plan.getUF());
-  VPValue *MulByUF = Builder.createNaryOp(Instruction::Mul, {RuntimeVF, UF});
+  VPValue *MulByUF = Builder.createOverflowingOp(Instruction::Mul,
+                                                 {RuntimeVF, UF}, {true, true});
----------------
fhahn wrote:

I am not sure NSW should be set here or if set it needs some explanation on why this is safe. For reference, `createElementCount` which is used above sets NUW, so setting just NUW would be in-line with that.

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


More information about the llvm-commits mailing list