[llvm-bugs] [Bug 46882] New: At least one condition is wrong (same conditional expr of if/else if) (llvm/lib/CodeGen/GlobalISel.cpp:1614 <=> 1617)

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 28 23:15:13 PDT 2020


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

            Bug ID: 46882
           Summary: At least one condition is wrong (same conditional expr
                    of if/else if) (llvm/lib/CodeGen/GlobalISel.cpp:1614
                    <=> 1617)
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: GlobalISel
          Assignee: unassignedbugs at nondot.org
          Reporter: info at ustchcs.com
                CC: llvm-bugs at lists.llvm.org, quentin.colombet at gmail.com

Created attachment 23784
  --> https://bugs.llvm.org/attachment.cgi?id=23784&action=edit
tool-report-screenshot

The use of if (Condition) {...} else if (Condition) {...} pattern should be
avoided.

(commit:23d6525cbdc9de7cbfe7640d1e9e4f25a0c5dd85)

llvm/lib/CodeGen/GlobalISel.cpp:

  1574  LegalizerHelper::LegalizeResult
  1575  LegalizerHelper::widenScalarExtract(MachineInstr &MI, unsigned TypeIdx,
  1576                                      LLT WideTy) {
  ...
  1612      // Do a shift in the source type.
  1613      LLT ShiftTy = SrcTy;
  1614      if (WideTy.getSizeInBits() > SrcTy.getSizeInBits()) {
  1615        Src = MIRBuilder.buildAnyExt(WideTy, Src);
  1616        ShiftTy = WideTy;
  1617      } else if (WideTy.getSizeInBits() > SrcTy.getSizeInBits())
  1618        return UnableToLegalize;
  1619  
  1620      auto LShr = MIRBuilder.buildLShr(
  1621        ShiftTy, Src, MIRBuilder.buildConstant(ShiftTy, Offset));
  1622      MIRBuilder.buildTrunc(DstReg, LShr);
  1623      MI.eraseFromParent();
  1624      return Legalized;
  1625    }
  ...
  1651  }

Reported by: Ustchcs Toolsets Bugfinder
(bugfinder-2.2: The use of if (Condition) {...} else if (Condition) {...}
pattern should be avoided.)

-- 
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/20200729/88467b6a/attachment.html>


More information about the llvm-bugs mailing list