diff options
author | aengelke <engelke@in.tum.de> | 2024-05-29 20:38:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-29 20:38:34 +0200 |
commit | 9fe7aef1889300a17a594efb55358ebd032a81a2 (patch) | |
tree | 91f993ac68010aa32efc837cda2ef32594283bff /llvm/lib/CodeGen/MachineFunction.cpp | |
parent | dcbd1fbdf46e74e9be80ec8e3e865b8347e8532b (diff) | |
download | llvm-9fe7aef1889300a17a594efb55358ebd032a81a2.zip llvm-9fe7aef1889300a17a594efb55358ebd032a81a2.tar.gz llvm-9fe7aef1889300a17a594efb55358ebd032a81a2.tar.bz2 |
[CodeGen] Don't check attrs for stack realign (#92564)
shouldRealignStack/canRealignStack are repeatedly called in PEI (through
hasStackRealignment). Checking function attributes is expensive, so
cache this data in the MachineFrameInfo, which had most data already.
This slightly changes the semantics of `MachineFrameInfo::ForcedRealign`
to be also true when the `stackrealign` attribute is set.
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunction.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineFunction.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index 8366ad2..4182e75 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/lib/CodeGen/MachineFunction.cpp @@ -200,10 +200,11 @@ void MachineFunction::init() { // explicitly asked us not to. bool CanRealignSP = STI->getFrameLowering()->isStackRealignable() && !F.hasFnAttribute("no-realign-stack"); + bool ForceRealignSP = F.hasFnAttribute(Attribute::StackAlignment) || + F.hasFnAttribute("stackrealign"); FrameInfo = new (Allocator) MachineFrameInfo( getFnStackAlignment(STI, F), /*StackRealignable=*/CanRealignSP, - /*ForcedRealign=*/CanRealignSP && - F.hasFnAttribute(Attribute::StackAlignment)); + /*ForcedRealign=*/ForceRealignSP && CanRealignSP); setUnsafeStackSize(F, *FrameInfo); |