[llvm] [mlir] [Dwarf] Support `__ptrauth` qualifier in metadata nodes (PR #83862)

Daniil Kovalev via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 18 23:12:55 PDT 2024


================
@@ -1566,8 +1566,17 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
       DWARFAddressSpace = Record[12] - 1;
 
     Metadata *Annotations = nullptr;
-    if (Record.size() > 13 && Record[13])
-      Annotations = getMDOrNull(Record[13]);
+    std::optional<DIDerivedType::PtrAuthData> PtrAuthData;
+
+    // Only look for annotations/ptrauth if both are allocated.
+    // If not, we can't tell which was intended to be embedded, as both ptrauth
+    // and annotations have been expected at Record[13] at various times.
+    if (Record.size() > 14) {
+      if (Record[13])
----------------
kovdan01 wrote:

Deleting this does not break any tests. However, even w/o this patch, when we had the code below, deleting check against `Record[13]` did not break any tests.

```
if (Record.size() > 13 && Record[13])
  Annotations = getMDOrNull(Record[13]);
```

So, there are either no test cases which check that or the `if` is redundant and probably already was redundant before. Since there are no other objections and the PR already got several approvals, I'll merge the PR and investigate this particular question later.

https://github.com/llvm/llvm-project/pull/83862


More information about the llvm-commits mailing list