[llvm-commits] [polly] fix for getNumberOfIterations

Sebastian Pop spop at codeaurora.org
Thu Dec 20 10:58:01 PST 2012


Sebastian Pop wrote:
> in isl/doc/user.pod.  Let me know how you want to fix the niter computation.
[...]

> --- a/include/polly/CodeGen/CodeGeneration.h
> +++ b/include/polly/CodeGen/CodeGeneration.h
> @@ -30,25 +30,32 @@ namespace polly {
>    static inline int getNumberOfIterations(__isl_take isl_set *Domain) {
>      int Dim = isl_set_dim(Domain, isl_dim_set);
>  
> +    if (Dim < 2)
> +      return -1;
> +
>      // Calculate a map similar to the identity map, but with the last input
>      // and output dimension not related.
>      //  [i0, i1, i2, i3] -> [i0, i1, i2, o0]
>      isl_space *Space = isl_set_get_space(Domain);
> -    Space = isl_space_drop_outputs(Space, Dim - 2, 1);

I have the impression that this is not the right fix: we should probably switch
this into an assert(Dim >= 2).

Tobi, can you please explain why we drop a dimension at "Dim - 2"?  Is that
because "Dim - 1" corresponds to the static scheduling time, and "Dim - 2" is
the dynamic time corresponding to the iterations of the innermost loop?

Thanks,
Sebastian
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation



More information about the llvm-commits mailing list