[llvm] r285930 - Fix a bug found by inspection by PVS-Studio.

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 3 09:39:25 PDT 2016


Author: chandlerc
Date: Thu Nov  3 11:39:25 2016
New Revision: 285930

URL: http://llvm.org/viewvc/llvm-project?rev=285930&view=rev
Log:
Fix a bug found by inspection by PVS-Studio.

This condition is trivially always true prior to the change. The comment
at the call site makes it clear that we expect *all* of these to be '=',
'S', or 'I' so fix the code.

We have a bug I will update to track the fact that Clang doesn't warn on
this: http://llvm.org/PR13101

Modified:
    llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp?rev=285930&r1=285929&r2=285930&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp Thu Nov  3 11:39:25 2016
@@ -205,7 +205,7 @@ static bool isOuterMostDepPositive(CharM
 static bool containsNoDependence(CharMatrix &DepMatrix, unsigned Row,
                                  unsigned Column) {
   for (unsigned i = 0; i < Column; ++i) {
-    if (DepMatrix[Row][i] != '=' || DepMatrix[Row][i] != 'S' ||
+    if (DepMatrix[Row][i] != '=' && DepMatrix[Row][i] != 'S' &&
         DepMatrix[Row][i] != 'I')
       return false;
   }




More information about the llvm-commits mailing list