[llvm] 585b41c - TargetOptions: Look up frame-pointer attribute once (#146639)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 2 04:09:23 PDT 2025
Author: Matt Arsenault
Date: 2025-07-02T20:09:20+09:00
New Revision: 585b41c2ecc0bf72b9956b86f1b19e21ff02259d
URL: https://github.com/llvm/llvm-project/commit/585b41c2ecc0bf72b9956b86f1b19e21ff02259d
DIFF: https://github.com/llvm/llvm-project/commit/585b41c2ecc0bf72b9956b86f1b19e21ff02259d.diff
LOG: TargetOptions: Look up frame-pointer attribute once (#146639)
Same as 07a86a525ea2f85ade9e224c200f0311fec9e433, except in
ther other case here.
Added:
Modified:
llvm/lib/CodeGen/TargetOptionsImpl.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/TargetOptionsImpl.cpp b/llvm/lib/CodeGen/TargetOptionsImpl.cpp
index def325efd5445..5eb86e740ff7c 100644
--- a/llvm/lib/CodeGen/TargetOptionsImpl.cpp
+++ b/llvm/lib/CodeGen/TargetOptionsImpl.cpp
@@ -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);
}
More information about the llvm-commits
mailing list