[PATCH] D106887: [LTO][Legacy] Add new API to check presence of ctor/dtor functions

Steven Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 27 09:38:30 PDT 2021


steven_wu requested changes to this revision.
steven_wu added a comment.
This revision now requires changes to proceed.

Comment inline.

It would be good if you can find a way to write testcase.



================
Comment at: llvm/lib/LTO/LTOModule.cpp:695
+    auto *GV = Sym.dyn_cast<GlobalValue *>();
+    if (GV->getName().startswith("llvm.global_")) {
+      StringRef Suffix = GV->getName().drop_front(sizeof("llvm.global_") - 1);
----------------
Can you simply this code a bit by using `consume_front()` on the name?

Also you need to check for nullptr for PointerUnion:
```
if (auto *GV = Sym.dyn_cast<>)
```


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

https://reviews.llvm.org/D106887



More information about the llvm-commits mailing list