https://github.com/perry-ca updated https://github.com/llvm/llvm-project/pull/208870
>From 5053cbf2c96d339e38ab57f96d4a53545eb9bcef Mon Sep 17 00:00:00 2001 From: Sean Perry <[email protected]> Date: Fri, 10 Jul 2026 23:10:54 -0400 Subject: [PATCH 1/3] Change zos-ppa1-name attr to be the name used in ppa1 --- clang/lib/CodeGen/CodeGenFunction.cpp | 2 +- llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp | 6 ++- llvm/test/CodeGen/SystemZ/zos-ppa1-name.ll | 37 +++++++++++++++++++ llvm/test/CodeGen/SystemZ/zos-ppa1.ll | 4 +- 4 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 llvm/test/CodeGen/SystemZ/zos-ppa1-name.ll diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 4f93e6c3d0ea1..7629b42dd313d 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -1204,7 +1204,7 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, } if (!CGM.getCodeGenOpts().ZOSPPA1Name) - Fn->addFnAttr("zos-ppa1-name", "none"); + Fn->addFnAttr("zos-ppa1-name", ""); if (CGM.getCodeGenOpts().WarnStackSize != UINT_MAX && !CGM.getDiags().isIgnored(diag::warn_fe_backend_frame_larger_than, Loc)) diff --git a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp index d1f19c27ca4d9..d5dc62253af53 100644 --- a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp +++ b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp @@ -1867,8 +1867,10 @@ void SystemZAsmPrinter::calculatePPA1() { // Save the calculated values. if (MF->getFunction().hasName() && - MF->getFunction().getFnAttribute("zos-ppa1-name").getValueAsString() != - "none") + MF->getFunction().hasFnAttribute("zos-ppa1-name")) { + Info.Name = + MF->getFunction().getFnAttribute("zos-ppa1-name").getValueAsString(); + } else Info.Name = MF->getFunction().getName(); Info.PPA1 = OutContext.createTempSymbol(Twine("PPA1_").concat(N), true); Info.EPMarker = OutContext.createTempSymbol(Twine("EPM_").concat(N), true); diff --git a/llvm/test/CodeGen/SystemZ/zos-ppa1-name.ll b/llvm/test/CodeGen/SystemZ/zos-ppa1-name.ll new file mode 100644 index 0000000000000..aaecf5fc0ad05 --- /dev/null +++ b/llvm/test/CodeGen/SystemZ/zos-ppa1-name.ll @@ -0,0 +1,37 @@ +; RUN: llc -mtriple s390x-ibm-zos -mcpu=z15 -asm-verbose=false < %s | FileCheck %s + +; This tests needs updating when the new external name is emitted into asm output. + +; CHECK: L#EPM_sourcename_0 DS 0H +; CHECK-NEXT: DC XL7'00C300C500C500' +; CHECK-NEXT: DC XL1'F1' +; CHECK-NEXT: DC AD(L#PPA1_sourcename_0-L#EPM_sourcename_0) +; CHECK-NEXT: DC XL4'00000008' +; CHECK-NEXT: ENTRY sourcename +; CHECK:sourcename DS 0H +;CHECK-NEXT: b 2(7) +;CHECK-NEXT: L#sourcename_end_0 DS 0H +;CHECK-NEXT: L#func_end0 DS 0H + +define void @sourcename() #0 { +entry: + ret void +} +attributes #0 = { "zos-ppa1-name"="name" } + +; CHECK:L#PPA1_sourcename_0 DS 0H +; CHECK-NEXT: DC XL1'02' +; CHECK-NEXT: DC XL1'CE' +; CHECK-NEXT: DC XL2'0000' +; CHECK-NEXT: DC AD(L#PPA2-L#PPA1_sourcename_0) +; CHECK-NEXT: DC XL1'80' +; CHECK-NEXT: DC XL1'80' +; CHECK-NEXT: DC XL1'00' +; CHECK-NEXT: DC XL1'81' +; CHECK-NEXT: DC XL2'0000' +; CHECK-NEXT: DC XL1'00' +; CHECK-NEXT: DC XL1'0' +; CHECK-NEXT: DC AD(L#sourcename_end_0-L#EPM_sourcename_0) +; CHECK-NEXT: DC XL2'0004' +; CHECK-NEXT: DC XL4'95819485' +; CHECK-NEXT: DC AD(L#EPM_sourcename_0-L#PPA1_sourcename_0) diff --git a/llvm/test/CodeGen/SystemZ/zos-ppa1.ll b/llvm/test/CodeGen/SystemZ/zos-ppa1.ll index ef37cf2ed19b5..89a4f9db117fb 100644 --- a/llvm/test/CodeGen/SystemZ/zos-ppa1.ll +++ b/llvm/test/CodeGen/SystemZ/zos-ppa1.ll @@ -207,7 +207,7 @@ declare i32 @other(ptr, i32) ; CHECK-NEXT: DC XL10'A689A388819393968381' ; CHECK-NEXT: DC AD(L#EPM_withalloca_0-L#PPA1_withalloca_0) -; Attribute "zos-ppa1-name"="none" removes the function name from PPA1. +; Attribute "zos-ppa1-name"="" removes the function name from PPA1. ; CHECK: * PPA1 ; CHECK-NEXT: L#PPA1_no_name_0 DS 0H ; CHECK: * PPA1 Flags 4 @@ -227,4 +227,4 @@ define void @no_name() #0 { entry: ret void } -attributes #0 = { "zos-ppa1-name"="none" } +attributes #0 = { "zos-ppa1-name" } >From e0f509c53440ccb69c9c6f6a29bf70430760e386 Mon Sep 17 00:00:00 2001 From: Sean Perry <[email protected]> Date: Fri, 10 Jul 2026 23:28:29 -0400 Subject: [PATCH 2/3] improve the logic --- llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp index d5dc62253af53..b655a24c433ff 100644 --- a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp +++ b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp @@ -1866,12 +1866,12 @@ void SystemZAsmPrinter::calculatePPA1() { determinePrologueStackUpdateSym(MF, EndOfPrologSym, StackUpdateSym); // Save the calculated values. - if (MF->getFunction().hasName() && - MF->getFunction().hasFnAttribute("zos-ppa1-name")) { + if (MF->getFunction().hasFnAttribute("zos-ppa1-name")) Info.Name = MF->getFunction().getFnAttribute("zos-ppa1-name").getValueAsString(); - } else + else if (MF->getFunction().hasName()) Info.Name = MF->getFunction().getName(); + Info.PPA1 = OutContext.createTempSymbol(Twine("PPA1_").concat(N), true); Info.EPMarker = OutContext.createTempSymbol(Twine("EPM_").concat(N), true); Info.FnEnd = OutContext.createTempSymbol(Twine(N).concat("end_")); >From 58b1c763c22b73bc9f277e8e98bbe72b666368f0 Mon Sep 17 00:00:00 2001 From: Sean Perry <[email protected]> Date: Mon, 13 Jul 2026 09:33:44 -0400 Subject: [PATCH 3/3] add clang test --- clang/test/CodeGen/SystemZ/zos-ppa1-name.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/test/CodeGen/SystemZ/zos-ppa1-name.c b/clang/test/CodeGen/SystemZ/zos-ppa1-name.c index 1f5db9b13307d..adf06d7f70ba6 100644 --- a/clang/test/CodeGen/SystemZ/zos-ppa1-name.c +++ b/clang/test/CodeGen/SystemZ/zos-ppa1-name.c @@ -10,8 +10,8 @@ // RUN: %clang_cc1 -triple s390x-ibm-zos -mno-zos-ppa1-name -emit-llvm %s -o -\ // RUN: | FileCheck %s -check-prefix=NOEMIT -// EMIT-NOT: attributes #0 = {{{.*}}"zos-ppa1-name"="none"{{.*}}} -// NOEMIT: attributes #0 = {{{.*}}"zos-ppa1-name"="none"{{.*}}} +// EMIT-NOT: attributes #0 = {{{.*}}"zos-ppa1-name"{{.*}}} +// NOEMIT: attributes #0 = {{{.*}}"zos-ppa1-name"{{.*}}} int main() { return 0; _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
