Index: llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp =================================================================== --- llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp +++ llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp @@ -63,12 +63,13 @@ } static bool usePackedStack(MachineFunction &MF) { - bool HasPackedStackAttr = MF.getFunction().hasFnAttribute("packed-stack"); + bool PackedStack = + MF.getFunction().getFnAttribute("packed-stack").getValueAsString() == "true"; bool IsVarArg = MF.getFunction().isVarArg(); bool CallConv = MF.getFunction().getCallingConv() != CallingConv::GHC; bool BackChain = MF.getFunction().hasFnAttribute("backchain"); bool FramAddressTaken = MF.getFrameInfo().isFrameAddressTaken(); - return HasPackedStackAttr && !IsVarArg && CallConv && !BackChain && + return PackedStack && !IsVarArg && CallConv && !BackChain && !FramAddressTaken; } Index: llvm/test/CodeGen/SystemZ/frame-22.ll =================================================================== --- llvm/test/CodeGen/SystemZ/frame-22.ll +++ llvm/test/CodeGen/SystemZ/frame-22.ll @@ -84,4 +84,25 @@ ret i64 %C } +; Test that a packed-stack function attribute of "false" gets the default layout. +define void @f5() #1 { +; CHECK-LABEL: f5: +; CHECK: stmg %r12, %r15, 96(%r15) +; CHECK-NEXT: .cfi_offset %r12, -64 +; CHECK-NEXT: .cfi_offset %r15, -40 +; CHECK-NEXT: aghi %r15, -8 +; CHECK-NEXT: .cfi_def_cfa_offset 168 +; CHECK-NEXT: std %f8, 0(%r15) # 8-byte Folded Spill +; CHECK-NEXT: .cfi_offset %f8, -168 +; CHECK-NEXT: #APP +; CHECK-NEXT: #NO_APP +; CHECK-NEXT: ld %f8, 0(%r15) # 8-byte Folded Reload +; CHECK-NEXT: lmg %r12, %r15, 104(%r15) +; CHECK-NEXT: br %r14 + call void asm sideeffect "", "~{f8},~{r12}"() nounwind + ret void +} + + attributes #0 = { "packed-stack"="true" } +attributes #1 = { "packed-stack"="false" }