[clang] [Clang][AMDGPU] Minor driver cleanups. NFC. (PR #187586)
Bruce Changlong Xu via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 19 14:00:13 PDT 2026
https://github.com/brucechanglongxu updated https://github.com/llvm/llvm-project/pull/187586
>From d384e3c8c92f88696fb4040aae5219f497e12ba6 Mon Sep 17 00:00:00 2001
From: Bruce Changlong Xu <brucechanglongxu at gmail.com>
Date: Thu, 19 Mar 2026 14:55:32 -0600
Subject: [PATCH] [Clang][AMDGPU] Minor driver cleanups. NFC.
---
clang/lib/Driver/ToolChains/AMDGPU.cpp | 7 +++----
clang/lib/Driver/ToolChains/HIPAMD.cpp | 3 +--
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp b/clang/lib/Driver/ToolChains/AMDGPU.cpp
index 7bbdb71b1e24f..1097b714f6c24 100644
--- a/clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -147,8 +147,7 @@ void RocmInstallationDetector::scanLibDevicePath(llvm::StringRef Path) {
llvm::Twine GfxName = Twine("gfx") + IsaVersionNumber;
SmallString<8> Tmp;
- LibDeviceMap.insert(
- std::make_pair(GfxName.toStringRef(Tmp), FilePath.str()));
+ LibDeviceMap.insert({GfxName.toStringRef(Tmp), FilePath.str()});
}
}
}
@@ -339,7 +338,7 @@ RocmInstallationDetector::RocmInstallationDetector(
unsigned Minor = ~0U;
SmallVector<StringRef, 3> Parts;
HIPVersionArg.split(Parts, '.');
- if (Parts.size())
+ if (!Parts.empty())
Parts[0].getAsInteger(0, Major);
if (Parts.size() > 1)
Parts[1].getAsInteger(0, Minor);
@@ -373,7 +372,7 @@ void RocmInstallationDetector::detectDeviceLibrary() {
assert(LibDevicePath.empty());
if (!RocmDeviceLibPathArg.empty())
- LibDevicePath = RocmDeviceLibPathArg[RocmDeviceLibPathArg.size() - 1];
+ LibDevicePath = RocmDeviceLibPathArg.back();
else if (std::optional<std::string> LibPathEnv =
llvm::sys::Process::GetEnv("HIP_DEVICE_LIB_PATH"))
LibDevicePath = std::move(*LibPathEnv);
diff --git a/clang/lib/Driver/ToolChains/HIPAMD.cpp b/clang/lib/Driver/ToolChains/HIPAMD.cpp
index 5b1bc6d8b6fd7..b08f610b21a16 100644
--- a/clang/lib/Driver/ToolChains/HIPAMD.cpp
+++ b/clang/lib/Driver/ToolChains/HIPAMD.cpp
@@ -207,8 +207,7 @@ void AMDGCN::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
- if (Inputs.size() > 0 &&
- Inputs[0].getType() == types::TY_Image &&
+ if (!Inputs.empty() && Inputs[0].getType() == types::TY_Image &&
JA.getType() == types::TY_Object)
return HIP::constructGenerateObjFileFromHIPFatBinary(C, Output, Inputs,
Args, JA, *this);
More information about the cfe-commits
mailing list