[llvm] [llvm][MC] Fix missing SubArch information when calling lookupTarget (PR #69902)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 23 19:23:32 PDT 2023


huaatian wrote:

> What if the subarch doesn't make sense for the new arch? The only test here seems to be doing a redundant setArch to the same as getArch already returns, which isn't an overly compelling use case. I don't think you want mips64r6 to turn into aarch64r6 when you do a setArch, for example?..

Thank you for your review comments.
In the lookupTarget function, the getArchName function determines the ArchName using both ArchType and the SubArch from TheTriple. Therefore, if there is a mismatch between ArchType and SubArch, the SubArch information will be discarded. So, if the ArchType is aarch64 and TheTriple is mips64r6, it will return aarch64, and TheTriple will be changed to aarch64. I think this is the expected behavior. What we want to solve is another situation: if TheTriple contains SubArch information, when the Arch matches, keep the information of TheTriple unchanged.

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


More information about the llvm-commits mailing list