[llvm-bugs] [Bug 41718] New: [X86] X86BaseInfo.h - getOperandBias - string literal in if()

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 2 13:54:22 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=41718

            Bug ID: 41718
           Summary: [X86] X86BaseInfo.h - getOperandBias - string literal
                    in if()
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, spatel+llvm at rotateright.com

inline unsigned getOperandBias(const MCInstrDesc& Desc) {
    ....
    case 2:
      // XCHG/XADD have two destinations and two sources.
      if (NumOps >= 4 && Desc.getOperandConstraint(2, MCOI::TIED_TO) == 0 &&
          Desc.getOperandConstraint(3, MCOI::TIED_TO) == 1)
        return 2;
      // Check for gather. AVX-512 has the second tied operand early. AVX2
      // has it as the last op.
      if (NumOps == 9 && Desc.getOperandConstraint(2, MCOI::TIED_TO) == 0 &&
          (Desc.getOperandConstraint(3, MCOI::TIED_TO) == 1 ||
           Desc.getOperandConstraint(8, MCOI::TIED_TO) == 1) &&
          "Instruction with 2 defs isn't gather?")
        return 2;
      return 0;
    }
  }

Cppcheck complains that we have a string literal (always resolves to true) in
the if() condition - shouldn't this just be a comment?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190502/15199aea/attachment.html>


More information about the llvm-bugs mailing list