[llvm] [VPlan] Improve code in VPInstruction::generate (NFC) (PR #169470)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 25 03:20:20 PST 2025


================
@@ -808,8 +807,7 @@ Value *VPInstruction::generate(VPTransformState &State) {
         cast<StructType>(State.TypeAnalysis.inferScalarType(getOperand(0)));
     Value *Res = PoisonValue::get(toVectorizedTy(StructTy, State.VF));
     for (const auto &[LaneIndex, Op] : enumerate(operands())) {
-      for (unsigned FieldIndex = 0; FieldIndex != StructTy->getNumElements();
-           FieldIndex++) {
+      for (unsigned FieldIndex : seq<unsigned>(StructTy->getNumElements())) {
----------------
david-arm wrote:

This works fine, but I think this is just personal preference. I don't find the new version any more readable than the old one to be honest.

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


More information about the llvm-commits mailing list