diff --git a/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp b/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp index d33b0ab7b9fcd..ead3529a7d841 100644 --- a/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp +++ b/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp @@ -2838,8 +2838,12 @@ bool AArch64InstructionSelector::select(MachineInstr &I) { assert(OpFlags == AArch64II::MO_GOT); } else { GV = I.getOperand(1).getGlobal(); - if (GV->isThreadLocal()) + if (GV->isThreadLocal()) { + // We don't support instructions with emulated TLS variables yet + if (TM.useEmulatedTLS()) + return false; return selectTLSGlobalValue(I, MRI); + } OpFlags = STI.ClassifyGlobalReference(GV, TM); }