[llvm] 8f826fe - Fix reverse-iteration buildbot.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 22 16:13:14 PDT 2022


Awesome - great to see the reverse iteration helping identify these
issues & such :)

On Fri, Aug 19, 2022 at 2:21 PM Eli Friedman via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
>
>
> Author: Eli Friedman
> Date: 2022-08-19T14:21:05-07:00
> New Revision: 8f826fe7233b97c58365252f78cb0f08288e9e06
>
> URL: https://github.com/llvm/llvm-project/commit/8f826fe7233b97c58365252f78cb0f08288e9e06
> DIFF: https://github.com/llvm/llvm-project/commit/8f826fe7233b97c58365252f78cb0f08288e9e06.diff
>
> LOG: Fix reverse-iteration buildbot.
>
> A couple of instances of iterating over maps snuck in while the bot was
> down; fix them to use maps with deterministic iteration.
>
> Added:
>
>
> Modified:
>     llvm/lib/CodeGen/GlobalMerge.cpp
>     llvm/lib/ProfileData/RawMemProfReader.cpp
>     llvm/test/tools/llvm-profdata/memprof-inline.test
>
> Removed:
>
>
>
> ################################################################################
> diff  --git a/llvm/lib/CodeGen/GlobalMerge.cpp b/llvm/lib/CodeGen/GlobalMerge.cpp
> index f5833d3b9086f..d65506d0232f6 100644
> --- a/llvm/lib/CodeGen/GlobalMerge.cpp
> +++ b/llvm/lib/CodeGen/GlobalMerge.cpp
> @@ -62,6 +62,7 @@
>
>  #include "llvm/ADT/BitVector.h"
>  #include "llvm/ADT/DenseMap.h"
> +#include "llvm/ADT/SetVector.h"
>  #include "llvm/ADT/SmallPtrSet.h"
>  #include "llvm/ADT/SmallVector.h"
>  #include "llvm/ADT/Statistic.h"
> @@ -181,7 +182,7 @@ namespace {
>      void collectUsedGlobalVariables(Module &M, StringRef Name);
>
>      /// Keep track of the GlobalVariable that must not be merged away
> -    SmallPtrSet<const GlobalVariable *, 16> MustKeepGlobalVariables;
> +    SmallSetVector<const GlobalVariable *, 16> MustKeepGlobalVariables;
>
>    public:
>      static char ID;             // Pass identification, replacement for typeid.
>
> diff  --git a/llvm/lib/ProfileData/RawMemProfReader.cpp b/llvm/lib/ProfileData/RawMemProfReader.cpp
> index 2423fd38e9a25..8a30855c79aa6 100644
> --- a/llvm/lib/ProfileData/RawMemProfReader.cpp
> +++ b/llvm/lib/ProfileData/RawMemProfReader.cpp
> @@ -310,7 +310,7 @@ Error RawMemProfReader::mapRawProfileToRecords() {
>    // it that is part of some dynamic allocation context. The location is stored
>    // as a pointer to a symbolized list of inline frames.
>    using LocationPtr = const llvm::SmallVector<FrameId> *;
> -  llvm::DenseMap<GlobalValue::GUID, llvm::SetVector<LocationPtr>>
> +  llvm::MapVector<GlobalValue::GUID, llvm::SetVector<LocationPtr>>
>        PerFunctionCallSites;
>
>    // Convert the raw profile callstack data into memprof records. While doing so
> @@ -378,7 +378,7 @@ Error RawMemProfReader::mapRawProfileToRecords() {
>      // we insert a new entry for callsite data if we need to.
>      auto Result = FunctionProfileData.insert({Id, IndexedMemProfRecord()});
>      IndexedMemProfRecord &Record = Result.first->second;
> -    for (LocationPtr Loc : I->getSecond()) {
> +    for (LocationPtr Loc : I->second) {
>        Record.CallSites.push_back(*Loc);
>      }
>    }
>
> diff  --git a/llvm/test/tools/llvm-profdata/memprof-inline.test b/llvm/test/tools/llvm-profdata/memprof-inline.test
> index bba6b1ec53064..88c56a97b44d1 100644
> --- a/llvm/test/tools/llvm-profdata/memprof-inline.test
> +++ b/llvm/test/tools/llvm-profdata/memprof-inline.test
> @@ -206,16 +206,6 @@ CHECK-NEXT:        LineOffset: 0
>  CHECK-NEXT:        Column: 18
>  CHECK-NEXT:        Inline: 0
>  CHECK-NEXT:  -
> -CHECK-NEXT:    FunctionGUID: 15822663052811949562
> -CHECK-NEXT:    CallSites:
> -CHECK-NEXT:    -
> -CHECK-NEXT:      -
> -CHECK-NEXT:        Function: 15822663052811949562
> -CHECK-NEXT:        SymbolName: main
> -CHECK-NEXT:        LineOffset: 1
> -CHECK-NEXT:        Column: 3
> -CHECK-NEXT:        Inline: 0
> -CHECK-NEXT:  -
>  CHECK-NEXT:    FunctionGUID: 16434608426314478903
>  CHECK-NEXT:    CallSites:
>  CHECK-NEXT:    -
> @@ -225,3 +215,13 @@ CHECK-NEXT:        SymbolName: bar
>  CHECK-NEXT:        LineOffset: 0
>  CHECK-NEXT:        Column: 19
>  CHECK-NEXT:        Inline: 0
> +CHECK-NEXT:  -
> +CHECK-NEXT:    FunctionGUID: 15822663052811949562
> +CHECK-NEXT:    CallSites:
> +CHECK-NEXT:    -
> +CHECK-NEXT:      -
> +CHECK-NEXT:        Function: 15822663052811949562
> +CHECK-NEXT:        SymbolName: main
> +CHECK-NEXT:        LineOffset: 1
> +CHECK-NEXT:        Column: 3
> +CHECK-NEXT:        Inline: 0
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list