[PATCH] D56586: [PPC64] Update LocalEntry from assigned symbols

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 21 21:25:35 PDT 2019


MaskRay added inline comments.


================
Comment at: lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp:194
     // the st_other bits encoding the local entry point offset.
-    if (Value->getKind() != MCExpr::SymbolRef)
-      return;
-    const auto &RhsSym = cast<MCSymbolELF>(
-        static_cast<const MCSymbolRefExpr *>(Value)->getSymbol());
-    unsigned Other = Symbol->getOther();
+    if (copyLocalEntry(Symbol, Value))
+      UpdateOther.insert(Symbol);
----------------
```
if (copyLocalEntry(Symbol, Value))
  (void)UpdateOther.insert(Symbol);
else
  (void)UpdateOther.erase(Symbol);
```

?


================
Comment at: lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp:204
+private:
+  std::set<MCSymbolELF *> UpdateOther;
+
----------------
Consider `SmallPtrSet`


================
Comment at: lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp:207
+  bool copyLocalEntry(MCSymbolELF *D, const MCExpr *S) {
+    if (S->getKind() != MCExpr::SymbolRef)
+      return false;
----------------
`S->getKind() != MCExpr::SymbolRef` + `static_cast<const MCSymbolRefExpr *>(S)->getSymbol()` may be changed to

```
auto *Ref = dyn_cast<const MCSymbolRefExpr>(S);
if (!Ref)
  return false;
...
```


Repository:
  rL LLVM

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

https://reviews.llvm.org/D56586





More information about the llvm-commits mailing list