[PATCH] D73739: Exception support for basic block sections

Rahman Lavaee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 16:26:42 PDT 2020


rahmanl added a comment.

In D73739#2299339 <https://reviews.llvm.org/D73739#2299339>, @MaskRay wrote:

> There is a compilation error:
>
>   llvm/lib/Target/ARM/ARMAsmPrinter.cpp:906:13: error: use of undeclared identifier 'getCurExceptionSym'
>       MCSym = getCurExceptionSym();

Thanks @MaskRay. Fixed.



================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1768
+  MCSymbol *ExceptionSym =
+      MBBSectionExceptionSyms.lookup(MBB->getSectionIDNum());
+  if (!ExceptionSym)
----------------
MaskRay wrote:
> The idiom is to use `try_emplace`. If a new element is inserted, replace it.
> 
> ```
> auto Res = MBBSectionExceptionSyms.try_emplace(MBB->getSectionIDNum());
> if (Res.second)
>   Res.first->second = createTempSymbol("exception");
> return Res.first->second;
> ```
Yes. MapVector doesn't support emplace methods.
Thinking more about this, I decided to simply use a DenseMap for MBBSectionExceptionSyms since we don't need the deterministic order for this map (It's not iterated through). And now we can use the code snippet above.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73739/new/

https://reviews.llvm.org/D73739



More information about the llvm-commits mailing list