summaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/TargetOptionsImpl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/TargetOptionsImpl.cpp')
-rw-r--r--llvm/lib/CodeGen/TargetOptionsImpl.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/TargetOptionsImpl.cpp b/llvm/lib/CodeGen/TargetOptionsImpl.cpp
index 01ffaed585ea..def325efd544 100644
--- a/llvm/lib/CodeGen/TargetOptionsImpl.cpp
+++ b/llvm/lib/CodeGen/TargetOptionsImpl.cpp
@@ -24,9 +24,10 @@ using namespace llvm;
bool TargetOptions::DisableFramePointerElim(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();
+ StringRef FP = FPAttr.getValueAsString();
if (FP == "all")
return true;
if (FP == "non-leaf")