[PATCH] [OPENMP] Fixed codegen for 'schedule' clause with non-constant chunk size.

Bataev, Alexey a.bataev at hotmail.com
Thu May 21 00:23:32 PDT 2015


John, I already reworked it and committed. I did as you said: captured 
it in the CapturedStmt, because globals cause a lot of troubles with 
offloading support. That's why this revision was abandoned.

Best regards,
Alexey Bataev
=============
Software Engineer
Intel Compiler Team

21.05.2015 10:06, John McCall пишет:
> Mostly seems fine, but using a global variable is problematic.
>
>
> ================
> Comment at: lib/CodeGen/CGStmtOpenMP.cpp:980
> @@ +979,3 @@
> +    CGF.Builder.CreateAlignedStore(Chunk, LoopChunk, Alignment);
> +    return LoopChunk;
> +  }
> ----------------
> Using a global variable here makes this non-reentrant.  Unless there's some weird restriction on where this clause can appear, that's not okay.
>
> You might have to capture this value in the CapturedStmt.  That should just be a matter of making an artificial VarDecl, initializing it to the captured value, and capturing it.  If you can capture it by value instead of by reference, that would be slightly preferable.
>
> ================
> Comment at: lib/CodeGen/CGStmtOpenMP.cpp:1052
> @@ -1020,5 +1051,3 @@
>           ScheduleKind = C->getScheduleKind();
> -        if (auto Ch = C->getChunkSize()) {
> -          Chunk = EmitScalarExpr(Ch);
> -          Chunk = EmitScalarConversion(Chunk, Ch->getType(),
> -                                       S.getIterationVariable()->getType());
> +        if (Chunk && Chunk->getType()->isPointerTy()) {
> +          Chunk = Builder.CreateAlignedLoad(
> ----------------
> Please test for a global value instead of checking the type.
>
> http://reviews.llvm.org/D9606
>
> EMAIL PREFERENCES
>    http://reviews.llvm.org/settings/panel/emailpreferences/
>
>





More information about the cfe-commits mailing list