================
@@ -873,6 +879,24 @@ AMDGPUTargetMachine::AMDGPUTargetMachine(const Target &T,
const Triple &TT,
TLOF(createTLOF(getTargetTriple())) {
initAsmInfo();
if (TT.isAMDGCN()) {
+ // Triple is missing a representation for non-empty, but unrecognized
+ // subarches. Only permit no subarch for any subtarget if it was really
+ // empty.
+ bool IsUnknownSubArch =
+ TT.getSubArch() == Triple::NoSubArch && TT.getArchName().size() != 6;
+ if (IsUnknownSubArch)
+ reportFatalUsageError("unknown subarch " + TT.getArchName());
+
+ if (TT.getSubArch() != Triple::NoSubArch) {
+ AMDGPU::GPUKind Kind = AMDGPU::parseArchAMDGCN(CPU);
+ Triple::SubArchType GPUSubArch = AMDGPU::getSubArch(Kind);
+ if (Kind != AMDGPU::GK_NONE && GPUSubArch != TT.getSubArch() &&
+ TT.getSubArch() != AMDGPU::getMajorSubArch(GPUSubArch)) {
----------------
slinder1 wrote:
Is that something we can "fix" with the switch to the new architecture? It
would require adding `Legacy` variants of things like `parseArchAMDGCN`, but
then in the "correct" versions we could add `.Case("",
AMDGPU::GPUKind::GK_EMPTY)` or something to differentiate the case?
https://github.com/llvm/llvm-project/pull/206480
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits