How to update the step of scf::forop?

I have created a forop.

Value outerstep = builder.create<arith::ConstantIndexOp>(elseLoc, 1);
auto forOp = builder.create<mlir::scf::ForOp>(elseLoc, outerlb, inputIndex, outerstep);

I need this type of forop: for(uint32_t i = 1; i < n; i *= 2) I don’t want to use whileop, I set the step in the following but there is an error.

forOp.setStep(forOpBody.create<arith::IndexCastOp>(forOpLoc,
                                            forOpBody.getIndexType(), stepIndex->getResult(0)));


error: operand #2 does not dominate this use
note: operand defined here (op in a child region)

This does not match what the scf::ForOp can do. The step isn’t a constant increment here.
You have to use the WhileOp, or create your own ForOp.