[llvm] d9dba4c - [NVPTXISelLowering] Remove unnecessary context parameter (NFCI)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 8 03:19:00 PST 2022


Author: Nikita Popov
Date: 2022-02-08T12:18:15+01:00
New Revision: d9dba4c782bc85127cad80515738a528d7259fc9

URL: https://github.com/llvm/llvm-project/commit/d9dba4c782bc85127cad80515738a528d7259fc9
DIFF: https://github.com/llvm/llvm-project/commit/d9dba4c782bc85127cad80515738a528d7259fc9.diff

LOG: [NVPTXISelLowering] Remove unnecessary context parameter (NFCI)

The module context shouldn't be relevant here, and should never
be null either.

Added: 
    

Modified: 
    llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
index 956fbfa393c5..e7a9ea5ebd66 100644
--- a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
@@ -2428,7 +2428,7 @@ NVPTXTargetLowering::getParamSymbol(SelectionDAG &DAG, int idx, EVT v) const {
 
 // Check to see if the kernel argument is image*_t or sampler_t
 
-static bool isImageOrSamplerVal(const Value *arg, const Module *context) {
+static bool isImageOrSamplerVal(const Value *arg) {
   static const char *const specialTypes[] = { "struct._image2d_t",
                                               "struct._image3d_t",
                                               "struct._sampler_t" };
@@ -2439,9 +2439,6 @@ static bool isImageOrSamplerVal(const Value *arg, const Module *context) {
   if (!PTy)
     return false;
 
-  if (!context)
-    return false;
-
   auto *STy = dyn_cast<StructType>(PTy->getPointerElementType());
   if (!STy || STy->isLiteral())
     return false;
@@ -2493,10 +2490,7 @@ SDValue NVPTXTargetLowering::LowerFormalArguments(
     // If the kernel argument is image*_t or sampler_t, convert it to
     // a i32 constant holding the parameter position. This can later
     // matched in the AsmPrinter to output the correct mangled name.
-    if (isImageOrSamplerVal(
-            theArgs[i],
-            (theArgs[i]->getParent() ? theArgs[i]->getParent()->getParent()
-                                     : nullptr))) {
+    if (isImageOrSamplerVal(theArgs[i])) {
       assert(isKernelFunction(*F) &&
              "Only kernels can have image/sampler params");
       InVals.push_back(DAG.getConstant(i + 1, dl, MVT::i32));


        


More information about the llvm-commits mailing list