Skip to content

Commit 82f5587

Browse files
committed
use llvm::find_if with reverse to find the last occurrence.
1 parent 6cb814d commit 82f5587

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/utils/TableGen/Common/CodeGenRegisters.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -869,9 +869,9 @@ void CodeGenRegisterClass::inheritProperties(CodeGenRegBank &RegBank) {
869869
// The last super-class is the smallest one in topological order. Check for
870870
// allocatable super-classes and inherit from the nearest allocatable one if
871871
// any.
872-
auto NearestAllocSCRIt = std::find_if(
873-
SuperClasses.rbegin(), SuperClasses.rend(),
874-
[&](const CodeGenRegisterClass *S) { return S->Allocatable; });
872+
auto NearestAllocSCRIt =
873+
find_if(reverse(SuperClasses),
874+
[&](const CodeGenRegisterClass *S) { return S->Allocatable; });
875875
CodeGenRegisterClass &Super = NearestAllocSCRIt == SuperClasses.rend()
876876
? *SuperClasses.back()
877877
: **NearestAllocSCRIt;

0 commit comments

Comments
 (0)