Skip to content

Commit 585b41c

Browse files
authored
TargetOptions: Look up frame-pointer attribute once (#146639)
Same as 07a86a5, except in ther other case here.
1 parent 35626e9 commit 585b41c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

llvm/lib/CodeGen/TargetOptionsImpl.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,11 @@ bool TargetOptions::DisableFramePointerElim(const MachineFunction &MF) const {
3939

4040
bool TargetOptions::FramePointerIsReserved(const MachineFunction &MF) const {
4141
const Function &F = MF.getFunction();
42-
43-
if (!F.hasFnAttribute("frame-pointer"))
42+
Attribute FPAttr = F.getFnAttribute("frame-pointer");
43+
if (!FPAttr.isValid())
4444
return false;
4545

46-
StringRef FP = F.getFnAttribute("frame-pointer").getValueAsString();
47-
return StringSwitch<bool>(FP)
46+
return StringSwitch<bool>(FPAttr.getValueAsString())
4847
.Cases("all", "non-leaf", "reserved", true)
4948
.Case("none", false);
5049
}

0 commit comments

Comments
 (0)