[PATCH] D134353: [AArch64] Add all predecessor archs in target info

Daniel Kiss via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 26 02:37:01 PDT 2022


danielkiss added inline comments.


================
Comment at: clang/lib/Basic/Targets/AArch64.cpp:541
+       --i)
+    Features[llvm::AArch64::getSubArch(i)] = Enabled;
+}
----------------
DavidSpickett wrote:
> It's not clear to me that you need 2 loops or the conditional here. What prevents you from just having:
> ```
> llvm::AArch64::ArchKind AK = llvm::AArch64::getSubArchArchKind(Name);
> for (llvm::AArch64::ArchKind i = llvm::AArch64::convertV9toV8(AK);
>   i != llvm::AArch64::ArchKind::INVALID; --i)
>     Features[llvm::AArch64::getSubArch(i)] = Enabled;
> ```
> 
> Given that converting anything that isn't v9 returns itself, then you walk backwards to all the previous architectures. Seems like you only need to do that once but tell me what I'm missing.
The iterator only works inside the architecture family 9/8.
so the first loop will set only the v8 counterparts while the second the v9.


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

https://reviews.llvm.org/D134353



More information about the llvm-commits mailing list