[llvm] [AArch64] Null check TargetStreamer before emitting .variant_pcs (PR #138924)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Mon May 12 00:44:09 PDT 2025


================
@@ -1370,9 +1370,9 @@ void AArch64AsmPrinter::emitFunctionEntryLabel() {
       MF->getFunction().getCallingConv() ==
           CallingConv::AArch64_SVE_VectorCall ||
       MF->getInfo<AArch64FunctionInfo>()->isSVECC()) {
-    auto *TS =
-        static_cast<AArch64TargetStreamer *>(OutStreamer->getTargetStreamer());
-    TS->emitDirectiveVariantPCS(CurrentFnSym);
+    if (auto *TS = static_cast<AArch64TargetStreamer *>(
----------------
sdesmalen-arm wrote:

Looking at this again, I think we should only emit the variant PCS attribute when the target's triple is ELF (`TM.getTargetTriple().isOSBinFormatELF()`) because this is specifically an ELF attribute. This means you can remove this condition, because for ELF targets it should never return a nullptr.

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


More information about the llvm-commits mailing list