[llvm] [SPIRV] Use llvm::all_of (NFC) (PR #144099)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 13 08:38:26 PDT 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/144099
We can pass a range to llvm::all_of.
>From 9ad0b1279f8499ad4a43fd21644087a970099c3c Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 12 Jun 2025 23:07:16 -0700
Subject: [PATCH] [SPIRV] Use llvm::all_of (NFC)
We can pass a range to llvm::all_of.
---
.../Target/SPIRV/SPIRVInstructionSelector.cpp | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp b/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
index 2dae0721886c7..f320ac0de5054 100644
--- a/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
@@ -1564,15 +1564,14 @@ static bool isUSMStorageClass(SPIRV::StorageClass::StorageClass SC) {
static bool isASCastInGVar(MachineRegisterInfo *MRI, Register ResVReg) {
bool IsGRef = false;
bool IsAllowedRefs =
- std::all_of(MRI->use_instr_begin(ResVReg), MRI->use_instr_end(),
- [&IsGRef](auto const &It) {
- unsigned Opcode = It.getOpcode();
- if (Opcode == SPIRV::OpConstantComposite ||
- Opcode == SPIRV::OpVariable ||
- isSpvIntrinsic(It, Intrinsic::spv_init_global))
- return IsGRef = true;
- return Opcode == SPIRV::OpName;
- });
+ llvm::all_of(MRI->use_instructions(ResVReg), [&IsGRef](auto const &It) {
+ unsigned Opcode = It.getOpcode();
+ if (Opcode == SPIRV::OpConstantComposite ||
+ Opcode == SPIRV::OpVariable ||
+ isSpvIntrinsic(It, Intrinsic::spv_init_global))
+ return IsGRef = true;
+ return Opcode == SPIRV::OpName;
+ });
return IsAllowedRefs && IsGRef;
}
More information about the llvm-commits
mailing list