[llvm] [SPIRV] Use llvm::all_of (NFC) (PR #144099)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 13 08:38:57 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-spir-v
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
We can pass a range to llvm::all_of.
---
Full diff: https://github.com/llvm/llvm-project/pull/144099.diff
1 Files Affected:
- (modified) llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp (+8-9)
``````````diff
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;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/144099
More information about the llvm-commits
mailing list