[PATCH] D19810: [scan-build] fix logic error warning in LLVM AMDGPU target code base

Apelete Seketeli via llvm-commits llvm-commits at lists.llvm.org
Thu May 12 16:05:45 PDT 2016


apelete updated this revision to Diff 57114.
apelete added a comment.
Herald added a subscriber: kzhuravl.

[scan-build] fix logic error warning in LLVM AMDGPU target code base

Changes since last revision:

- rebased patch on trunk and validated against test suite.


http://reviews.llvm.org/D19810

Files:
  lib/Target/AMDGPU/SIInstrInfo.cpp

Index: lib/Target/AMDGPU/SIInstrInfo.cpp
===================================================================
--- lib/Target/AMDGPU/SIInstrInfo.cpp
+++ lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -1849,9 +1849,15 @@
   const MCOperandInfo &OpInfo = InstDesc.OpInfo[OpIdx];
   const TargetRegisterClass *DefinedRC =
       OpInfo.RegClass != -1 ? RI.getRegClass(OpInfo.RegClass) : nullptr;
+
   if (!MO)
     MO = &MI->getOperand(OpIdx);
 
+  if (!DefinedRC) {
+    // This operand expects an immediate.
+    return !MO->isReg();
+  }
+
   if (isVALU(*MI) &&
       usesConstantBus(MRI, *MO, DefinedRC->getSize())) {
 
@@ -1876,15 +1882,9 @@
     return isLegalRegOperand(MRI, OpInfo, *MO);
   }
 
-
   // Handle non-register types that are treated like immediates.
   assert(MO->isImm() || MO->isTargetIndex() || MO->isFI());
 
-  if (!DefinedRC) {
-    // This operand expects an immediate.
-    return true;
-  }
-
   return isImmOperandLegal(MI, OpIdx, *MO);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19810.57114.patch
Type: text/x-patch
Size: 959 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160512/d88dc84c/attachment.bin>


More information about the llvm-commits mailing list