summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2016-03-30 12:31:51 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2016-03-30 12:31:51 +0000
commit9415e06da74daa11c187a02ef339009d80a5268c (patch)
treeff96bb6375f36827cc20acbfde73d81047359ea4
parenta5a750eaf1898690d32af94660ca2dbf617a615d (diff)
downloadbcm5719-llvm-9415e06da74daa11c187a02ef339009d80a5268c.tar.gz
bcm5719-llvm-9415e06da74daa11c187a02ef339009d80a5268c.zip
[NVPTX] Avoid temporary std::string and make single-use function local to the cpp file.
No functionality change intended. llvm-svn: 264861
-rw-r--r--llvm/lib/Target/NVPTX/NVPTX.h2
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp7
2 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/Target/NVPTX/NVPTX.h b/llvm/lib/Target/NVPTX/NVPTX.h
index fd1b84792b6..5f429b69e2d 100644
--- a/llvm/lib/Target/NVPTX/NVPTX.h
+++ b/llvm/lib/Target/NVPTX/NVPTX.h
@@ -56,8 +56,6 @@ FunctionPass *createNVPTXLowerKernelArgsPass(const NVPTXTargetMachine *TM);
BasicBlockPass *createNVPTXLowerAllocaPass();
MachineFunctionPass *createNVPTXPeephole();
-bool isImageOrSamplerVal(const Value *, const Module *);
-
extern Target TheNVPTXTarget32;
extern Target TheNVPTXTarget64;
diff --git a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
index 592a269d1a0..79689b41763 100644
--- a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
@@ -2039,7 +2039,7 @@ NVPTXTargetLowering::getParamSymbol(SelectionDAG &DAG, int idx, EVT v) const {
// 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 Value *arg, const Module *context) {
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(
OpenPOWER on IntegriCloud