[llvm-bugs] [Bug 44768] New: Redundant expressions in LLVM code

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Feb 4 04:17:52 PST 2020


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

            Bug ID: 44768
           Summary: Redundant expressions in LLVM code
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Transformation Utilities
          Assignee: unassignedbugs at nondot.org
          Reporter: alexey.v.romanov at gmail.com
                CC: llvm-bugs at lists.llvm.org

When running my expanded version of misc-redundant-expression on LLVM source,
following potential problems were found (after filtering false positives):

llvm/utils/TableGen/CodeGenDAGPatterns.cpp:483:35: warning: both sides of
operator are equivalent [misc-redundant-expression]
    if (any_of(S, isIntegerOrPtr) && any_of(S, isIntegerOrPtr)) {
                                  ^
llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:3875:34: warning: 'true' and
'false' expressions are equivalent [misc-redundant-expression]
    return UseSPE ? PPC::PRED_LE : PPC::PRED_LE;
                                 ^
llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:3878:34: warning: 'true' and
'false' expressions are equivalent [misc-redundant-expression]
    return UseSPE ? PPC::PRED_GT : PPC::PRED_GT;
                                 ^
polly/lib/Support/ISLTools.cpp:67:23: warning: both sides of operator are
equivalent [misc-redundant-expression]
  for (auto i = Dims1 - Dims1; i < Dims1; i += 1)
                      ^
polly/lib/Support/ISLTools.cpp:69:23: warning: both sides of operator are
equivalent [misc-redundant-expression]
  for (auto i = Dims2 - Dims2; i < Dims2; i += 1) {
                      ^
llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp:175:79: warning: Operator has
equivalent nested operands [misc-redundant-expression]
      Config.DiscardMode != DiscardType::None || !Config.SymbolsToAdd.empty()
||
                                                                              ^
(the last one repeats Config.StripNonAlloc and Config.StripSections twice)

These can probably remain, but I am not sure: 

clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp:45:17:
warning: expression is redundant [misc-redundant-expression]
    if (TokKind == tok::NUM_TOKENS || TokKind != tok::comment)
                ^
llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp:122:24: warning: expression is
redundant [misc-redundant-expression]
    assert(TiedToIndex == -1 ||
                       ^

-- 
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/20200204/098c6f59/attachment-0001.html>


More information about the llvm-bugs mailing list