sfantao added inline comments. ================ Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:3044-3054 @@ +3043,13 @@ + Sizes.push_back(Size); + MapTypes.push_back(MapType); + } + + // Keep track on whether the host function has to be executed. + auto OffloadErrorQType = + CGF.getContext().getIntTypeForBitwidth(/*DestWidth=*/32, /*Signed=*/true); + auto OffloadError = CGF.CreateMemTemp(OffloadErrorQType, ".run_host_version"); + CGF.EmitStoreOfScalar(llvm::Constant::getNullValue(CGM.Int32Ty), OffloadError, + /*Volatile=*/false, OffloadErrorQType); + + // Fill up the pointer arrays and transfer execution to the device. + auto &&ThenGen = [this, BasePointers, Pointers, Sizes, MapTypes, ---------------- ABataev wrote: > Not quite. getVLASize() works only for VLA types, while getTypeSize() works > for types with constant size too. Oh, sure. Done!
================ Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:3050 @@ +3049,3 @@ + CGF.getContext().getIntTypeForBitwidth(/*DestWidth=*/32, /*Signed=*/true); + auto OffloadError = CGF.CreateMemTemp(OffloadErrorQType, ".run_host_version"); + CGF.EmitStoreOfScalar(llvm::Constant::getNullValue(CGM.Int32Ty), OffloadError, ---------------- ABataev wrote: > Turn this to LValue like > CGF.MakeAddrLValue(CGF.CreateMemTemp(OffloadErrorQType, ".run_host_version"), > OffloadErrorQType); and use this Lvalue rather than Address. Done! ================ Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:3055-3057 @@ +3054,5 @@ + // Fill up the pointer arrays and transfer execution to the device. + auto &&ThenGen = [this, BasePointers, Pointers, Sizes, MapTypes, + hasVLACaptures, Device, OffloadError, + OffloadErrorQType](CodeGenFunction &CGF) { + unsigned PointerNumVal = BasePointers.size(); ---------------- ABataev wrote: > Pointers, Sizes, MapTypes must be captured by reference. Oh, sure. Done! ================ Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:3198-3204 @@ +3197,9 @@ + + // Notify that the host version must be executed. + auto &&ElseGen = [this, OffloadError, + OffloadErrorQType](CodeGenFunction &CGF) { + CGF.EmitStoreOfScalar(llvm::ConstantInt::get(CGM.Int32Ty, /*V=*/-1u), + OffloadError, /*Volatile=*/false, OffloadErrorQType); + }; + + if (IfCond) { ---------------- ABataev wrote: > Move this to 'then' branch of the next if-stmt. Ok, done. http://reviews.llvm.org/D12871 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits