[PATCH] D76519: [NFC] Refactor how CFI section types are represented in AsmPrinter

Venkata Ramanaiah Nalamothu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 26 20:56:01 PDT 2021


RamNalamothu added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:359
         break;
-      }
+      if (ModuleCFISection == AsmPrinter::CFISection::None)
+        ModuleCFISection = getFunctionCFISectionType(F);
----------------
MaskRay wrote:
> ```
> ModuleCFISection = getFunctionCFISectionType(F);
> if (ModuleCFISection == AsmPrinter::CFISection::EH)
>   break;
> ```
Ah!

> ```
> ModuleCFISection = getFunctionCFISectionType(F);
> if (ModuleCFISection == AsmPrinter::CFISection::EH)
>   break;
> ```

But wouldn't this give incorrect results if we see CFISection::Debug first and then a CFISection::None function as the last one i.e. without a CFISection::EH in between?
That is what I was trying to avoid in my original patch.

May be the following is a better one?

```
if (ModuleCFISection == AsmPrinter::CFISection::EH)
  break;

if (getFunctionCFISectionType(F) != AsmPrinter::CFISection::None)
  ModuleCFISection = getFunctionCFISectionType(F);
```



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76519



More information about the llvm-commits mailing list