[NFC] Introduce range based singleton searches for loop queries.
authorJamie Schmeiser <schmeise@ca.ibm.com>
Wed, 26 Oct 2022 17:50:11 +0000 (13:50 -0400)
committerJamie Schmeiser <schmeise@ca.ibm.com>
Wed, 26 Oct 2022 17:50:11 +0000 (13:50 -0400)
commitb115ba005030281d9dc85655fbfddf99c0dd82c1
treeaba21a3168aab10550eaa01f76a03325760a6ce2
parentad78ce44bb4771139d2a18d6e1052268a7507a52
[NFC] Introduce range based singleton searches for loop queries.

Summary:
Several loop queries look for a singleton by finding all instances and then
returning whether there is 1 instance or not. This can be improved by
stopping the search after 2 have been found. Introduce generic range
based singleton searches that stop after finding a second value
and use them for these loop queries.

There is no intended functional change other than improved compile-time
efficiency.

Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By: Meinersbur (Michael Kruse)
Differential Revision: https://reviews.llvm.org/D136261
llvm/include/llvm/ADT/STLExtras.h
llvm/include/llvm/Analysis/LoopInfoImpl.h
llvm/include/llvm/Analysis/RegionInfoImpl.h