[llvm] [X86] Use hasSingleElement (NFC) (PR #133040)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 25 23:33:35 PDT 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/133040
None
>From 8ee889874a90bc40e0d08a5a7ca4a0dee2e39349 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Tue, 18 Jun 2024 00:15:11 -0700
Subject: [PATCH] [X86] Use hasSingleElement (NFC)
---
llvm/lib/Target/X86/X86CmovConversion.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/lib/Target/X86/X86CmovConversion.cpp b/llvm/lib/Target/X86/X86CmovConversion.cpp
index 00bb1e588bd9b..d639ca56b77d6 100644
--- a/llvm/lib/Target/X86/X86CmovConversion.cpp
+++ b/llvm/lib/Target/X86/X86CmovConversion.cpp
@@ -555,7 +555,7 @@ bool X86CmovConverterPass::checkForProfitableCmovCandidates(
// This is another conservative check to avoid converting CMOV instruction
// used with tree-search like algorithm, where the branch is unpredicted.
auto UIs = MRI->use_instructions(MI->defs().begin()->getReg());
- if (!UIs.empty() && ++UIs.begin() == UIs.end()) {
+ if (hasSingleElement(UIs)) {
unsigned Op = UIs.begin()->getOpcode();
if (Op == X86::MOV64rm || Op == X86::MOV32rm) {
WorthOpGroup = false;
More information about the llvm-commits
mailing list