goldsteinn wrote: No bug was different: ``` - Builder.SetInsertPoint(LoopIncrPN); + Builder.SetInsertPoint(Rem); ``` If the loop was multiple BBs we would be inserting rem in wrong locations... https://github.com/llvm/llvm-project/pull/96625