Silence compiler warning. NFC.
authorMichael Kruse <llvm-project@meinersbur.de>
Mon, 10 Feb 2020 17:13:00 +0000 (11:13 -0600)
committerMichael Kruse <llvm-project@meinersbur.de>
Mon, 10 Feb 2020 17:38:22 +0000 (11:38 -0600)
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

polly/lib/Support/ISLTools.cpp

index 08bb0529424cf60140b0cbf5a9b0aba558b269a8..c18ccdce4ed37f59d9d21023b8b8ffe47d75b6da 100644 (file)
@@ -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);
   }