From 3fb3df36eaeecaea59de42e3d3f4eec79c3aac4e Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Wed, 18 Oct 2023 13:04:45 -0700 Subject: [PATCH] [ModuleInliner] Use SmallVector::pop_back_val (NFC) We can use std::pop_heap first and then retrieve the top priority item with pop_back_val, saving one line of code. --- llvm/lib/Analysis/InlineOrder.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Analysis/InlineOrder.cpp b/llvm/lib/Analysis/InlineOrder.cpp index b086ac15a207..1bdb3b98bc87 100644 --- a/llvm/lib/Analysis/InlineOrder.cpp +++ b/llvm/lib/Analysis/InlineOrder.cpp @@ -255,11 +255,10 @@ public: assert(size() > 0); adjust(); - CallBase *CB = Heap.front(); + std::pop_heap(Heap.begin(), Heap.end(), isLess); + CallBase *CB = Heap.pop_back_val(); T Result = std::make_pair(CB, InlineHistoryMap[CB]); InlineHistoryMap.erase(CB); - std::pop_heap(Heap.begin(), Heap.end(), isLess); - Heap.pop_back(); return Result; }