[llvm] r360028 - [X86] X86InstrInfo::findThreeSrcCommutedOpIndices - fix unread variable warning.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon May 6 03:15:34 PDT 2019


Author: rksimon
Date: Mon May  6 03:15:34 2019
New Revision: 360028

URL: http://llvm.org/viewvc/llvm-project?rev=360028&view=rev
Log:
[X86] X86InstrInfo::findThreeSrcCommutedOpIndices - fix unread variable warning.

scan-build was reporting that CommutableOpIdx1 never used its original initialized value - move it down to where its first used to make the real initialization more obvious (and matches the comment that's there).

Modified:
    llvm/trunk/lib/Target/X86/X86InstrInfo.cpp

Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=360028&r1=360027&r2=360028&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Mon May  6 03:15:34 2019
@@ -1769,7 +1769,6 @@ X86InstrInfo::findThreeSrcCommutedOpIndi
   // regardless of the FMA opcode. The FMA opcode is adjusted later.
   if (SrcOpIdx1 == CommuteAnyOperandIndex ||
       SrcOpIdx2 == CommuteAnyOperandIndex) {
-    unsigned CommutableOpIdx1 = SrcOpIdx1;
     unsigned CommutableOpIdx2 = SrcOpIdx2;
 
     // At least one of operands to be commuted is not specified and
@@ -1785,6 +1784,8 @@ X86InstrInfo::findThreeSrcCommutedOpIndi
     // CommutableOpIdx2 is well defined now. Let's choose another commutable
     // operand and assign its index to CommutableOpIdx1.
     unsigned Op2Reg = MI.getOperand(CommutableOpIdx2).getReg();
+
+    unsigned CommutableOpIdx1;
     for (CommutableOpIdx1 = LastCommutableVecOp;
          CommutableOpIdx1 >= FirstCommutableVecOp; CommutableOpIdx1--) {
       // Just ignore and skip the k-mask operand.




More information about the llvm-commits mailing list