[polly] r311548 - [PPCGCodeGen] Fix compiler warning: '<': signed/unsigned mismatch. NFC.
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 23 05:45:25 PDT 2017
Author: meinersbur
Date: Wed Aug 23 05:45:25 2017
New Revision: 311548
URL: http://llvm.org/viewvc/llvm-project?rev=311548&view=rev
Log:
[PPCGCodeGen] Fix compiler warning: '<': signed/unsigned mismatch. NFC.
MSVC warns about comparison between a signed and unsigned integer.
The rules of C(++) define that an unsigned comparison has to be
carried-out in this case. This is unlikely to be intended.
Fix by assigning the loop's upper bound to a signed integer first.
This also avoids repeated evaluation of the invariant upper bound.
Modified:
polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
Modified: polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp?rev=311548&r1=311547&r2=311548&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp Wed Aug 23 05:45:25 2017
@@ -1131,7 +1131,7 @@ Value *GPUNodeBuilder::getArrayOffset(gp
isl::set ZeroSet = isl::set::universe(Min.get_space());
- for (long i = 0; i < Min.dim(isl::dim::set); i++)
+ for (long i = 0, n = Min.dim(isl::dim::set); i < n; i++)
ZeroSet = ZeroSet.fix_si(isl::dim::set, i, 0);
if (Min.is_subset(ZeroSet)) {
@@ -1140,7 +1140,7 @@ Value *GPUNodeBuilder::getArrayOffset(gp
isl::ast_expr Result = isl::ast_expr::from_val(isl::val(Min.get_ctx(), 0));
- for (long i = 0; i < Min.dim(isl::dim::set); i++) {
+ for (long i = 0, n = Min.dim(isl::dim::set); i < n; i++) {
if (i > 0) {
isl::pw_aff Bound_I =
isl::manage(isl_multi_pw_aff_get_pw_aff(Array->bound, i - 1));
@@ -1473,7 +1473,7 @@ GPUNodeBuilder::getReferencesInKernel(pp
SubtreeValues.remove(SAI->getBasePtr());
isl_space *Space = S.getParamSpace().release();
- for (long i = 0; i < isl_space_dim(Space, isl_dim_param); i++) {
+ for (long i = 0, n = isl_space_dim(Space, isl_dim_param); i < n; i++) {
isl_id *Id = isl_space_get_dim_id(Space, isl_dim_param, i);
assert(IDToValue.count(Id));
Value *Val = IDToValue[Id];
@@ -1482,7 +1482,7 @@ GPUNodeBuilder::getReferencesInKernel(pp
}
isl_space_free(Space);
- for (long i = 0; i < isl_space_dim(Kernel->space, isl_dim_set); i++) {
+ for (long i = 0, n = isl_space_dim(Kernel->space, isl_dim_set); i < n; i++) {
isl_id *Id = isl_space_get_dim_id(Kernel->space, isl_dim_set, i);
assert(IDToValue.count(Id));
Value *Val = IDToValue[Id];
@@ -1991,7 +1991,7 @@ GPUNodeBuilder::createKernelFunctionDecl
isl_ast_build *Build =
isl_ast_build_from_context(isl_set_copy(Prog->context));
Sizes.push_back(nullptr);
- for (long j = 1; j < Kernel->array[i].array->n_index; j++) {
+ for (long j = 1, n = Kernel->array[i].array->n_index; j < n; j++) {
isl_ast_expr *DimSize = isl_ast_build_expr_from_pw_aff(
Build, isl_multi_pw_aff_get_pw_aff(Kernel->array[i].array->bound, j));
auto V = ExprBuilder.create(DimSize);
@@ -3246,7 +3246,7 @@ public:
auto *Univ = isl_set_universe(Space);
isl_pw_aff *OneAff = isl_pw_aff_val_on_domain(Univ, One);
- for (long i = 0; i < isl_set_dim(Set, isl_dim_set); i++) {
+ for (long i = 0, n = isl_set_dim(Set, isl_dim_set); i < n; i++) {
isl_pw_aff *Max = isl_set_dim_max(isl_set_copy(Set), i);
isl_pw_aff *Min = isl_set_dim_min(isl_set_copy(Set), i);
isl_pw_aff *DimSize = isl_pw_aff_sub(Max, Min);
More information about the llvm-commits
mailing list