[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-28 Thread Alexey Bataev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG6ee6fa28a74e: [OpenMP5.0] Allow pointer arithmetic in motion/map clause, by Chi Chun Chen (authored by cchen, committed by ABataev). Changed prior to commit: https://reviews.llvm.org/D75077?vs=247303&id

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-28 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added a comment. In D75077#1898678 , @cchen wrote: > @ABataev, can you land it for me when you have time? > > Thanks, > Chi Chun Sure Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75077/new/ http

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-28 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen added a comment. @ABataev, can you land it for me when you have time? Thanks, Chi Chun Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75077/new/ https://reviews.llvm.org/D75077 ___ cfe-commits ma

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-28 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LGTM Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75077/new/ https://reviews.llvm.org/D75077 _

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-28 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen updated this revision to Diff 247303. cchen added a comment. return RelevantExpr || Visit(LE); Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75077/new/ https://reviews.llvm.org/D75077 Files: clang/include/clang/Basic/DiagnosticSemaKinds.td

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-28 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen updated this revision to Diff 247298. cchen added a comment. Add assert to make sure that we never overwrite RelevantExpr Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75077/new/ https://reviews.llvm.org/D75077 Files: clang/include/clang/B

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-28 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments. Comment at: clang/lib/Sema/SemaOpenMP.cpp:15499-15501 RelevantExpr = DRE; // Record the component. Components.emplace_back(DRE, DRE->getDecl()); ABataev wrote: > cchen wrote: > > ABataev wrote: > > > Shall we do this

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-28 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments. Comment at: clang/lib/Sema/SemaOpenMP.cpp:15499-15501 RelevantExpr = DRE; // Record the component. Components.emplace_back(DRE, DRE->getDecl()); cchen wrote: > ABataev wrote: > > Shall we do this only if `RelevantExpr

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-28 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen marked an inline comment as done. cchen added inline comments. Comment at: clang/lib/Sema/SemaOpenMP.cpp:15499-15501 RelevantExpr = DRE; // Record the component. Components.emplace_back(DRE, DRE->getDecl()); ABataev wrote: > Shall we do this

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-28 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments. Comment at: clang/lib/Sema/SemaOpenMP.cpp:15499-15501 RelevantExpr = DRE; // Record the component. Components.emplace_back(DRE, DRE->getDecl()); Shall we do this only if `RelevantExpr` is nullptr? C

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-27 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen updated this revision to Diff 247122. cchen added a comment. Add test Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75077/new/ https://reviews.llvm.org/D75077 Files: clang/include/clang/Basic/DiagnosticSemaKinds.td clang/lib/CodeGen/CGOp

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-27 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen added a comment. In D75077#1896708 , @cchen wrote: > Add back the check of UO_Deref Haven't added tests for some prohibited test cases. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75077/new/ https

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-27 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen updated this revision to Diff 247101. cchen added a comment. Add back the check of UO_Deref Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75077/new/ https://reviews.llvm.org/D75077 Files: clang/include/clang/Basic/DiagnosticSemaKinds.td

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-27 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added a comment. Also, would be good to add more tests for the situations that should not be handled, like just `(a+b)`, explicit casts, etc. Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:9966 +def err_omp_non_lvalue_in_map_or_motion_clauses: Error< + "

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-27 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen updated this revision to Diff 247095. cchen added a comment. Fix based on feedback Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75077/new/ https://reviews.llvm.org/D75077 Files: clang/include/clang/Basic/DiagnosticSemaKinds.td clang/lib

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-27 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments. Comment at: clang/lib/Sema/SemaOpenMP.cpp:15684-15685 + bool VisitUnaryOperator(UnaryOperator *UO) { +if (SemaRef.getLangOpts().OpenMP < 50 || UO->getOpcode() != UO_Deref || +!UO->isLValue()) { + emitErrorMsg(); AB

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-27 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments. Comment at: clang/lib/Sema/SemaOpenMP.cpp:15684-15685 + bool VisitUnaryOperator(UnaryOperator *UO) { +if (SemaRef.getLangOpts().OpenMP < 50 || UO->getOpcode() != UO_Deref || +!UO->isLValue()) { + emitErrorMsg(); `U

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-27 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen updated this revision to Diff 247073. cchen added a comment. Fix test and add check for unary operator. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75077/new/ https://reviews.llvm.org/D75077 Files: clang/include/clang/Basic/DiagnosticSem

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-27 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen updated this revision to Diff 247075. cchen marked 14 inline comments as done. cchen added a comment. Remove redundant else Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75077/new/ https://reviews.llvm.org/D75077 Files: clang/include/clang

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-27 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments. Comment at: clang/test/OpenMP/target_update_codegen.cpp:374 + // CK6-64-DAG: [[IDX_EXT]] = sext i32 [[TWO:%.+]] to i64 + // CK6-DAG: [[TWO:%.+]] = load i32, i32* [[L_ADDR:%.+]] + // CK6-DAG: store i32 [[L:%.+]], i32* [[L_ADDR]] c

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-27 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments. Comment at: clang/lib/Sema/SemaOpenMP.cpp:15710 +// know the other subtree is just an offset) +assert(BO->getType()->isPointerType() && + "Expect the binary operator be pointer type"); cchen wrote: > cchen wrote: >

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-27 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen marked an inline comment as done. cchen added inline comments. Comment at: clang/lib/Sema/SemaOpenMP.cpp:15710 +// know the other subtree is just an offset) +assert(BO->getType()->isPointerType() && + "Expect the binary operator be pointer type");

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-27 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen marked 2 inline comments as done. cchen added inline comments. Comment at: clang/lib/Sema/SemaOpenMP.cpp:15710 +// know the other subtree is just an offset) +assert(BO->getType()->isPointerType() && + "Expect the binary operator be pointer type");

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-27 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments. Comment at: clang/lib/Sema/SemaOpenMP.cpp:15690 + return false; +if (!UO->isLValue()) { + emitErrorMsg(); Hmm, addr_of creates rvalues. Comment at: clang/lib/Sema/SemaOpenMP.cpp:15693 + return f

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-27 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen updated this revision to Diff 247022. cchen added a comment. Fix based on feedback Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75077/new/ https://reviews.llvm.org/D75077 Files: clang/include/clang/Basic/DiagnosticSemaKinds.td clang/lib

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-26 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments. Comment at: clang/test/OpenMP/target_update_codegen.cpp:371-372 + // CK6-DAG: store i32* [[ADD_PTR:%.+]], i32** [[PC0]] + // CK6-DAG: [[ADD_PTR]] = getelementptr inbounds i32, i32* [[ONE:%.+]], i{{32|64}} [[IDX_EXT:%.+]] + // CK6-DAG: [[TWO:%.+]

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-26 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen marked 2 inline comments as done. cchen added inline comments. Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:9965 "memory order clause '%0' is specified here">; +def err_omp_non_lvalue_in_map_or_motion_clauses: Error< + "expected lvalue with no function c

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-26 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments. Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:9965 "memory order clause '%0' is specified here">; +def err_omp_non_lvalue_in_map_or_motion_clauses: Error< + "expected lvalue with no function call in '#pragma omp target update' and

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-26 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen marked an inline comment as done. cchen added inline comments. Comment at: clang/lib/Sema/SemaOpenMP.cpp:15683 } + bool VisitUnaryOperator(UnaryOperator *UO) { +if (SemaRef.getLangOpts().OpenMP < 50) { ABataev wrote: > cchen wrote: > > ABataev wrote

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-25 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments. Comment at: clang/lib/Sema/SemaOpenMP.cpp:15683 } + bool VisitUnaryOperator(UnaryOperator *UO) { +if (SemaRef.getLangOpts().OpenMP < 50) { cchen wrote: > ABataev wrote: > > I think you need to extend this to support paren ex

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-25 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen marked 5 inline comments as done. cchen added inline comments. Comment at: clang/lib/Sema/SemaOpenMP.cpp:15683 } + bool VisitUnaryOperator(UnaryOperator *UO) { +if (SemaRef.getLangOpts().OpenMP < 50) { ABataev wrote: > I think you need to extend thi

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-25 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen marked 6 inline comments as done. cchen added inline comments. Comment at: clang/lib/CodeGen/CGOpenMPRuntime.cpp:7633 +isa(Next->getAssociatedExpression()) || +isa(Next->getAssociatedExpression())) && "Unexpected expression");

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-25 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen updated this revision to Diff 246495. cchen added a comment. Add BinaryOperator in components and fix logic in MapBaseChecker. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75077/new/ https://reviews.llvm.org/D75077 Files: clang/include/cl

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-25 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments. Comment at: clang/lib/Sema/SemaOpenMP.cpp:15683 } + bool VisitUnaryOperator(UnaryOperator *UO) { +if (SemaRef.getLangOpts().OpenMP < 50) { I think you need to extend this to support paren expressions, at least. ===

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-24 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen marked an inline comment as done. cchen added inline comments. Comment at: clang/lib/Sema/SemaOpenMP.cpp:15712 +const std::string RTS = RT->getCanonicalTypeInternal().getAsString(); +auto CntLayer = [](char c) { return c == '*' || c == '['; }; +size_t LLayerCnt

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-24 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen updated this revision to Diff 246304. cchen added a comment. Remove the counting in MapBaseChecker, instead, comparing the type of root with the type of LHS and RHS, and only visit the subtree having the same type as root. This scheme pass all the test I have. I'll add BinOp into components

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-24 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments. Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:9965 "memory order clause '%0' is specified here">; +def err_omp_non_lvalue_in_map_or_motion_clauses: Error< + "expected lvalue with no function call in '#pragma omp target update' and

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-24 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen marked 4 inline comments as done. cchen added inline comments. Comment at: clang/lib/CodeGen/CGOpenMPRuntime.cpp:7616 dyn_cast(I->getAssociatedExpression()); + const auto *UO = dyn_cast(I->getAssociatedExpression()); bool IsPointer =

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-24 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments. Comment at: clang/lib/CodeGen/CGOpenMPRuntime.cpp:7616 dyn_cast(I->getAssociatedExpression()); + const auto *UO = dyn_cast(I->getAssociatedExpression()); bool IsPointer = What about binary operator?

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-24 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen updated this revision to Diff 246293. cchen added a comment. Remove redundant code in test. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75077/new/ https://reviews.llvm.org/D75077 Files: clang/include/clang/Basic/DiagnosticSemaKinds.td

[PATCH] D75077: [OpenMP5.0] Allow pointer arithmetic in motion/map clause

2020-02-24 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen created this revision. cchen added a reviewer: ABataev. Herald added subscribers: cfe-commits, guansong. Herald added a reviewer: jdoerfert. Herald added a project: clang. Base declaration in pointer arithmetic expression is determined by binary search with type information. Take "int *a, *b