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: unassignedb...@nondot.org
          Reporter: i...@ustchcs.com
                CC: llvm-bugs@lists.llvm.org, quentin.colom...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to