[llvm] r264861 - [NVPTX] Avoid temporary std::string and make single-use function local to the cpp file.
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 30 05:31:52 PDT 2016
Author: d0k
Date: Wed Mar 30 07:31:51 2016
New Revision: 264861
URL: http://llvm.org/viewvc/llvm-project?rev=264861&view=rev
Log:
[NVPTX] Avoid temporary std::string and make single-use function local to the cpp file.
No functionality change intended.
Modified:
llvm/trunk/lib/Target/NVPTX/NVPTX.h
llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp
Modified: llvm/trunk/lib/Target/NVPTX/NVPTX.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTX.h?rev=264861&r1=264860&r2=264861&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTX.h (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTX.h Wed Mar 30 07:31:51 2016
@@ -56,8 +56,6 @@ FunctionPass *createNVPTXLowerKernelArgs
BasicBlockPass *createNVPTXLowerAllocaPass();
MachineFunctionPass *createNVPTXPeephole();
-bool isImageOrSamplerVal(const Value *, const Module *);
-
extern Target TheNVPTXTarget32;
extern Target TheNVPTXTarget64;
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp?rev=264861&r1=264860&r2=264861&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp Wed Mar 30 07:31:51 2016
@@ -2039,7 +2039,7 @@ NVPTXTargetLowering::getParamSymbol(Sele
// Check to see if the kernel argument is image*_t or sampler_t
-bool llvm::isImageOrSamplerVal(const Value *arg, const Module *context) {
+static bool isImageOrSamplerVal(const Value *arg, const Module *context) {
static const char *const specialTypes[] = { "struct._image2d_t",
"struct._image3d_t",
"struct._sampler_t" };
@@ -2054,10 +2054,11 @@ bool llvm::isImageOrSamplerVal(const Val
return false;
auto *STy = dyn_cast<StructType>(PTy->getElementType());
- const std::string TypeName = STy && !STy->isLiteral() ? STy->getName() : "";
+ if (!STy || STy->isLiteral())
+ return false;
return std::find(std::begin(specialTypes), std::end(specialTypes),
- TypeName) != std::end(specialTypes);
+ STy->getName()) != std::end(specialTypes);
}
SDValue NVPTXTargetLowering::LowerFormalArguments(
More information about the llvm-commits
mailing list