[AMDGPU] isSDNodeAlwaysUniform - silence static analyzer dyn_cast<LoadSDNode> null...
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 22 Sep 2019 21:01:13 +0000 (21:01 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 22 Sep 2019 21:01:13 +0000 (21:01 +0000)
The static analyzer is warning about a potential null dereference, but we should be able to use cast<LoadSDNode> directly and if not assert will fire for us.

llvm-svn: 372528

llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp

index c24ea04..203cc67 100644 (file)
@@ -718,9 +718,8 @@ bool AMDGPUTargetLowering::isSDNodeAlwaysUniform(const SDNode * N) const {
     break;
     case ISD::LOAD:
     {
-      const LoadSDNode * L = dyn_cast<LoadSDNode>(N);
-      if (L->getMemOperand()->getAddrSpace()
-      == AMDGPUAS::CONSTANT_ADDRESS_32BIT)
+      if (cast<LoadSDNode>(N)->getMemOperand()->getAddrSpace() ==
+          AMDGPUAS::CONSTANT_ADDRESS_32BIT)
         return true;
       return false;
     }