[polly] 84c934a - Silence compiler warning. NFC.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 10 09:39:27 PST 2020


Author: Michael Kruse
Date: 2020-02-10T11:38:22-06:00
New Revision: 84c934a5cbe2fdb7e0bb61a94e4dfa5e6cc3e0b2

URL: https://github.com/llvm/llvm-project/commit/84c934a5cbe2fdb7e0bb61a94e4dfa5e6cc3e0b2
DIFF: https://github.com/llvm/llvm-project/commit/84c934a5cbe2fdb7e0bb61a94e4dfa5e6cc3e0b2.diff

LOG: Silence compiler warning. NFC.

The idiom

    for (auto i = n - n; i < n; i += 1)

was intended to automatically derive the type of i from n
(signed/unsigned int) and avoid the 'mixed signed/unsigned comparison'
warning. However, almost-always-auto was never used in the LLVM coding
style (although we used it in Polly for some time) and I did never
intended to use this idiom upstream.

PVS Studio may warns about this idiom as 'warning: both sides of
operator are equivalent [misc-redundant-expression]'.

Remove the use of auto and directly use unsigned.

Also see http://llvm.org/PR44768

Added: 
    

Modified: 
    polly/lib/Support/ISLTools.cpp

Removed: 
    


################################################################################
diff  --git a/polly/lib/Support/ISLTools.cpp b/polly/lib/Support/ISLTools.cpp
index 08bb0529424c..c18ccdce4ed3 100644
--- a/polly/lib/Support/ISLTools.cpp
+++ b/polly/lib/Support/ISLTools.cpp
@@ -64,9 +64,9 @@ isl::basic_map makeTupleSwapBasicMap(isl::space FromSpace1,
   isl::space MapSpace = FromSpace.map_from_domain_and_range(ToSpace);
 
   isl::basic_map Result = isl::basic_map::universe(MapSpace);
-  for (auto i = Dims1 - Dims1; i < Dims1; i += 1)
+  for (unsigned i = 0u; i < Dims1; i += 1)
     Result = Result.equate(isl::dim::in, i, isl::dim::out, Dims2 + i);
-  for (auto i = Dims2 - Dims2; i < Dims2; i += 1) {
+  for (unsigned i = 0u; i < Dims2; i += 1) {
     Result = Result.equate(isl::dim::in, Dims1 + i, isl::dim::out, i);
   }
 


        


More information about the llvm-commits mailing list