TargetOptions: Look up frame-pointer attribute once (#146639)
Same as 07a86a525e, except in
ther other case here.
This commit is contained in:
@@ -39,12 +39,11 @@ bool TargetOptions::DisableFramePointerElim(const MachineFunction &MF) const {
|
||||
|
||||
bool TargetOptions::FramePointerIsReserved(const MachineFunction &MF) const {
|
||||
const Function &F = MF.getFunction();
|
||||
|
||||
if (!F.hasFnAttribute("frame-pointer"))
|
||||
Attribute FPAttr = F.getFnAttribute("frame-pointer");
|
||||
if (!FPAttr.isValid())
|
||||
return false;
|
||||
|
||||
StringRef FP = F.getFnAttribute("frame-pointer").getValueAsString();
|
||||
return StringSwitch<bool>(FP)
|
||||
return StringSwitch<bool>(FPAttr.getValueAsString())
|
||||
.Cases("all", "non-leaf", "reserved", true)
|
||||
.Case("none", false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user