Use bottom tested loop in detectCycles()


The loop is being entered right after adding an element to the tested
container, i.e. the container can't ever be empty then. This allows to
skip the first test and only test after each iterations which may reduce
the number of jumps.

Pick-to: 6.12 6.11 6.10 6.8
Change-Id: Ic854f701aea9f37af57a458a0546225500810b4b
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
commit74048341140326b01d51f081bc889e1b4365fbb1
parentfae62ed8e91c796cafaedb1a47db91995ccb0eac
authorRobert Löhning <robert.loehning@qt.io>
committerRobert Löhning <robert.loehning@qt.io>
commit timeWed, 10 Jun 2026 11:20:39 +0000