================ @@ -340,8 +340,14 @@ Value *VPInstruction::generateInstruction(VPTransformState &State, auto *Phi = State.get(getOperand(0), 0); // The loop step is equal to the vectorization factor (num of SIMD // elements) times the unroll factor (num of SIMD instructions). - Value *Step = - createStepForVF(Builder, Phi->getType(), State.VF, State.UF); + Value *Step; + { + BasicBlock *VectorPH = State.CFG.getPreheaderBBFor(this); + IRBuilder<> PHBuilder(VectorPH->getTerminator()); + // Step is loop-invariant, calls to vscale will be placed in the + // preheader. + Step = createStepForVF(PHBuilder, Phi->getType(), State.VF, State.UF); + } ---------------- ayalz wrote:
```suggestion // Step is loop-invariant, calls to vscale will be placed in the preheader. BasicBlock *VectorPH = State.CFG.getPreheaderBBFor(this); IRBuilder<> PHBuilder(VectorPH->getTerminator()); Value *Step = createStepForVF(PHBuilder, Phi->getType(), State.VF, State.UF); ``` (no need for the bracketed block, which was needed for the point guard.) https://github.com/llvm/llvm-project/pull/74762 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits