This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG220e77a83af1: [clang][CodeGenPGO] Don't use an invalid index when region counts disagree (authored by lanza).
Changed prior to commit: https://reviews.llvm.org/D149504?vs=518108&id=521200#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D149504/new/ https://reviews.llvm.org/D149504 Files: clang/lib/CodeGen/CodeGenPGO.h Index: clang/lib/CodeGen/CodeGenPGO.h =================================================================== --- clang/lib/CodeGen/CodeGenPGO.h +++ clang/lib/CodeGen/CodeGenPGO.h @@ -114,7 +114,12 @@ return 0; if (!haveRegionCounts()) return 0; - return RegionCounts[(*RegionCounterMap)[S]]; + // With profiles from a differing version of clang we can have mismatched + // decl counts. Don't crash in such a case. + auto Index = (*RegionCounterMap)[S]; + if (Index >= RegionCounts.size()) + return 0; + return RegionCounts[Index]; } };
Index: clang/lib/CodeGen/CodeGenPGO.h =================================================================== --- clang/lib/CodeGen/CodeGenPGO.h +++ clang/lib/CodeGen/CodeGenPGO.h @@ -114,7 +114,12 @@ return 0; if (!haveRegionCounts()) return 0; - return RegionCounts[(*RegionCounterMap)[S]]; + // With profiles from a differing version of clang we can have mismatched + // decl counts. Don't crash in such a case. + auto Index = (*RegionCounterMap)[S]; + if (Index >= RegionCounts.size()) + return 0; + return RegionCounts[Index]; } };
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits