[PATCH] D127686: [Offloading] Embed the target features in the OffloadBinary

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 13 17:30:19 PDT 2022


tra added inline comments.


================
Comment at: clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp:735
+  llvm::StringMap<unsigned> LastOpt;
+  for (unsigned I = 0, N = Features.size(); I < N; ++I) {
+    StringRef Name = Features[I];
----------------
// Record the index of the last occurence of the feature.


================
Comment at: clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp:741
+
+  for (unsigned I = 0, N = Features.size(); I < N; ++I) {
+    StringRef Name = Features[I];
----------------
// Populate UnifiedFeatures only with last mentions of specific feature.




================
Comment at: clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp:743-748
+    llvm::StringMap<unsigned>::iterator LastI =
+        LastOpt.find(Name.drop_front(1));
+    assert(LastI != LastOpt.end());
+    unsigned Last = LastI->second;
+    if (Last != I)
+      continue;
----------------
```
auto FeatureName = Name.drop_front(1); 
if (!LastOpt.count(FeatureName)) // could be just assert(LastOpt.count(FeatureName))
  continue
if (LastOpt[FeatureName] != I) // could be merged with the `if` above
  continue;
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127686



More information about the cfe-commits mailing list