jyu2 updated this revision to Diff 417944. jyu2 added a comment. Address Alexey's comment.
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122338/new/ https://reviews.llvm.org/D122338 Files: clang/lib/CodeGen/CGOpenMPRuntime.cpp clang/test/OpenMP/declare_simd_codegen.cpp Index: clang/test/OpenMP/declare_simd_codegen.cpp =================================================================== --- clang/test/OpenMP/declare_simd_codegen.cpp +++ clang/test/OpenMP/declare_simd_codegen.cpp @@ -153,6 +153,23 @@ // CHECK-DAG: "_ZGVdN4v__Z5add_1Pf" // CHECK-DAG: "_ZGVeN8v__Z5add_1Pf" +// CHECK-NOT: _ZGVbN2vv__Z5add_1Pf +// CHECK-NOT: _ZGVcN4vv__Z5add_1Pf +// CHECK-NOT: _ZGVdN4vv__Z5add_1Pf +// CHECK-NOT: _ZGVeN8vv__Z5add_1Pf +// CHECK-NOT: _ZGVbM32vv__Z5add_1Pf +// CHECK-NOT: _ZGVcM32vv__Z5add_1Pf +// CHECK-NOT: _ZGVdM32vv__Z5add_1Pf +// CHECK-NOT: _ZGVeM32vv__Z5add_1Pf +// CHECK-NOT: _ZGVbN4l32v__Z5add_1Pf +// CHECK-NOT: _ZGVcN8l32v__Z5add_1Pf +// CHECK-NOT: _ZGVdN8l32v__Z5add_1Pf +// CHECK-NOT: _ZGVeN16l32v__Z5add_1Pf +// CHECK-NOT: _ZGVbM4l32v__Z5add_1Pf +// CHECK-NOT: _ZGVcM8l32v__Z5add_1Pf +// CHECK-NOT: _ZGVdM8l32v__Z5add_1Pf +// CHECK-NOT: _ZGVeM16l32v__Z5add_1Pf + // CHECK-DAG: "_ZGVbM2va16va16vv__Z1hIiEvPT_S1_S1_S1_" // CHECK-DAG: "_ZGVbN2va16va16vv__Z1hIiEvPT_S1_S1_S1_" // CHECK-DAG: "_ZGVcM4va16va16vv__Z1hIiEvPT_S1_S1_S1_" Index: clang/lib/CodeGen/CGOpenMPRuntime.cpp =================================================================== --- clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -11968,16 +11968,16 @@ llvm::Function *Fn) { ASTContext &C = CGM.getContext(); FD = FD->getMostRecentDecl(); - // Map params to their positions in function decl. - llvm::DenseMap<const Decl *, unsigned> ParamPositions; - if (isa<CXXMethodDecl>(FD)) - ParamPositions.try_emplace(FD, 0); - unsigned ParamPos = ParamPositions.size(); - for (const ParmVarDecl *P : FD->parameters()) { - ParamPositions.try_emplace(P->getCanonicalDecl(), ParamPos); - ++ParamPos; - } while (FD) { + // Map params to their positions in function decl. + llvm::DenseMap<const Decl *, unsigned> ParamPositions; + if (isa<CXXMethodDecl>(FD)) + ParamPositions.try_emplace(FD, 0); + unsigned ParamPos = ParamPositions.size(); + for (const ParmVarDecl *P : FD->parameters()) { + ParamPositions.try_emplace(P->getCanonicalDecl(), ParamPos); + ++ParamPos; + } for (const auto *Attr : FD->specific_attrs<OMPDeclareSimdDeclAttr>()) { llvm::SmallVector<ParamAttrTy, 8> ParamAttrs(ParamPositions.size()); // Mark uniform parameters. @@ -11989,6 +11989,7 @@ } else { const auto *PVD = cast<ParmVarDecl>(cast<DeclRefExpr>(E)->getDecl()) ->getCanonicalDecl(); + assert(ParamPositions.find(PVD) != ParamPositions.end()); Pos = ParamPositions[PVD]; } ParamAttrs[Pos].Kind = Uniform; @@ -12005,6 +12006,7 @@ } else { const auto *PVD = cast<ParmVarDecl>(cast<DeclRefExpr>(E)->getDecl()) ->getCanonicalDecl(); + assert(ParamPositions.find(PVD) != ParamPositions.end()); Pos = ParamPositions[PVD]; ParmTy = PVD->getType(); } @@ -12030,6 +12032,7 @@ } else { const auto *PVD = cast<ParmVarDecl>(cast<DeclRefExpr>(E)->getDecl()) ->getCanonicalDecl(); + assert(ParamPositions.find(PVD) != ParamPositions.end()); Pos = ParamPositions[PVD]; if (auto *P = dyn_cast<PointerType>(PVD->getType())) PtrRescalingFactor = CGM.getContext() @@ -12048,6 +12051,8 @@ if (const auto *StridePVD = dyn_cast<ParmVarDecl>(DRE->getDecl())) { ParamAttr.Kind = LinearWithVarStride; + assert(ParamPositions.find(StridePVD->getCanonicalDecl()) != + ParamPositions.end()); ParamAttr.StrideOrArg = llvm::APSInt::getUnsigned( ParamPositions[StridePVD->getCanonicalDecl()]); }
Index: clang/test/OpenMP/declare_simd_codegen.cpp =================================================================== --- clang/test/OpenMP/declare_simd_codegen.cpp +++ clang/test/OpenMP/declare_simd_codegen.cpp @@ -153,6 +153,23 @@ // CHECK-DAG: "_ZGVdN4v__Z5add_1Pf" // CHECK-DAG: "_ZGVeN8v__Z5add_1Pf" +// CHECK-NOT: _ZGVbN2vv__Z5add_1Pf +// CHECK-NOT: _ZGVcN4vv__Z5add_1Pf +// CHECK-NOT: _ZGVdN4vv__Z5add_1Pf +// CHECK-NOT: _ZGVeN8vv__Z5add_1Pf +// CHECK-NOT: _ZGVbM32vv__Z5add_1Pf +// CHECK-NOT: _ZGVcM32vv__Z5add_1Pf +// CHECK-NOT: _ZGVdM32vv__Z5add_1Pf +// CHECK-NOT: _ZGVeM32vv__Z5add_1Pf +// CHECK-NOT: _ZGVbN4l32v__Z5add_1Pf +// CHECK-NOT: _ZGVcN8l32v__Z5add_1Pf +// CHECK-NOT: _ZGVdN8l32v__Z5add_1Pf +// CHECK-NOT: _ZGVeN16l32v__Z5add_1Pf +// CHECK-NOT: _ZGVbM4l32v__Z5add_1Pf +// CHECK-NOT: _ZGVcM8l32v__Z5add_1Pf +// CHECK-NOT: _ZGVdM8l32v__Z5add_1Pf +// CHECK-NOT: _ZGVeM16l32v__Z5add_1Pf + // CHECK-DAG: "_ZGVbM2va16va16vv__Z1hIiEvPT_S1_S1_S1_" // CHECK-DAG: "_ZGVbN2va16va16vv__Z1hIiEvPT_S1_S1_S1_" // CHECK-DAG: "_ZGVcM4va16va16vv__Z1hIiEvPT_S1_S1_S1_" Index: clang/lib/CodeGen/CGOpenMPRuntime.cpp =================================================================== --- clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -11968,16 +11968,16 @@ llvm::Function *Fn) { ASTContext &C = CGM.getContext(); FD = FD->getMostRecentDecl(); - // Map params to their positions in function decl. - llvm::DenseMap<const Decl *, unsigned> ParamPositions; - if (isa<CXXMethodDecl>(FD)) - ParamPositions.try_emplace(FD, 0); - unsigned ParamPos = ParamPositions.size(); - for (const ParmVarDecl *P : FD->parameters()) { - ParamPositions.try_emplace(P->getCanonicalDecl(), ParamPos); - ++ParamPos; - } while (FD) { + // Map params to their positions in function decl. + llvm::DenseMap<const Decl *, unsigned> ParamPositions; + if (isa<CXXMethodDecl>(FD)) + ParamPositions.try_emplace(FD, 0); + unsigned ParamPos = ParamPositions.size(); + for (const ParmVarDecl *P : FD->parameters()) { + ParamPositions.try_emplace(P->getCanonicalDecl(), ParamPos); + ++ParamPos; + } for (const auto *Attr : FD->specific_attrs<OMPDeclareSimdDeclAttr>()) { llvm::SmallVector<ParamAttrTy, 8> ParamAttrs(ParamPositions.size()); // Mark uniform parameters. @@ -11989,6 +11989,7 @@ } else { const auto *PVD = cast<ParmVarDecl>(cast<DeclRefExpr>(E)->getDecl()) ->getCanonicalDecl(); + assert(ParamPositions.find(PVD) != ParamPositions.end()); Pos = ParamPositions[PVD]; } ParamAttrs[Pos].Kind = Uniform; @@ -12005,6 +12006,7 @@ } else { const auto *PVD = cast<ParmVarDecl>(cast<DeclRefExpr>(E)->getDecl()) ->getCanonicalDecl(); + assert(ParamPositions.find(PVD) != ParamPositions.end()); Pos = ParamPositions[PVD]; ParmTy = PVD->getType(); } @@ -12030,6 +12032,7 @@ } else { const auto *PVD = cast<ParmVarDecl>(cast<DeclRefExpr>(E)->getDecl()) ->getCanonicalDecl(); + assert(ParamPositions.find(PVD) != ParamPositions.end()); Pos = ParamPositions[PVD]; if (auto *P = dyn_cast<PointerType>(PVD->getType())) PtrRescalingFactor = CGM.getContext() @@ -12048,6 +12051,8 @@ if (const auto *StridePVD = dyn_cast<ParmVarDecl>(DRE->getDecl())) { ParamAttr.Kind = LinearWithVarStride; + assert(ParamPositions.find(StridePVD->getCanonicalDecl()) != + ParamPositions.end()); ParamAttr.StrideOrArg = llvm::APSInt::getUnsigned( ParamPositions[StridePVD->getCanonicalDecl()]); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits