[llvm] r260816 - [Hexagon] Replace use of "std::map::emplace" with "insert"

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 16 16:08:40 PST 2016


On Sat, Feb 13, 2016 at 6:06 AM, Krzysztof Parzyszek via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: kparzysz
> Date: Sat Feb 13 08:06:01 2016
> New Revision: 260816
>
> URL: http://llvm.org/viewvc/llvm-project?rev=260816&view=rev
> Log:
> [Hexagon] Replace use of "std::map::emplace" with "insert"
>
> Gcc 4.7.2-4 does not seem to have "emplace" in its implementation of map.
> This should fix the build failure on polly-amd64-linux.
>
>
> Modified:
>     llvm/trunk/lib/Target/Hexagon/HexagonFrameLowering.cpp
>
> Modified: llvm/trunk/lib/Target/Hexagon/HexagonFrameLowering.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonFrameLowering.cpp?rev=260816&r1=260815&r2=260816&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/Hexagon/HexagonFrameLowering.cpp (original)
> +++ llvm/trunk/lib/Target/Hexagon/HexagonFrameLowering.cpp Sat Feb 13
> 08:06:01 2016
> @@ -1762,7 +1762,10 @@ void HexagonFrameLowering::optimizeSpill
>    // and collect relevant information.
>    for (auto &B : MF) {
>      std::map<int,IndexType> LastStore, LastLoad;
> -    auto P = BlockIndexes.emplace(&B,
> HexagonBlockRanges::InstrIndexMap(B));
> +    // Emplace appears not to be supported in gcc 4.7.2-4.
> +    //auto P = BlockIndexes.emplace(&B,
> HexagonBlockRanges::InstrIndexMap(B));
> +    auto TmpP = std::make_pair(&B, HexagonBlockRanges::InstrIndexMap(B));
>

This would cause the InstrIndexMap to be copied on insertion, if you just
roll it inot the insert (or call std::move on the insert) it should be a
bit more efficient by being able to move from the InstrIndexMap into the
BlockIndexes.


> +    auto P = BlockIndexes.insert(TmpP);
>      auto &IndexMap = P.first->second;
>      DEBUG(dbgs() << "Index map for BB#" << B.getNumber() << "\n"
>                   << IndexMap << '\n');
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160216/8e6aac1c/attachment.html>


More information about the llvm-commits mailing list