Skip to content

Commit 07a86a5

Browse files
authored
CodeGen: Look up frame-pointer attribute once (#142902)
Instead of pre-checking if the frame-pointer attribute is present, just query the attribute and see if it's valid.
1 parent 3fc216b commit 07a86a5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/CodeGen/TargetOptionsImpl.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ using namespace llvm;
2424
bool TargetOptions::DisableFramePointerElim(const MachineFunction &MF) const {
2525
const Function &F = MF.getFunction();
2626

27-
if (!F.hasFnAttribute("frame-pointer"))
27+
Attribute FPAttr = F.getFnAttribute("frame-pointer");
28+
if (!FPAttr.isValid())
2829
return false;
29-
StringRef FP = F.getFnAttribute("frame-pointer").getValueAsString();
30+
StringRef FP = FPAttr.getValueAsString();
3031
if (FP == "all")
3132
return true;
3233
if (FP == "non-leaf")

0 commit comments

Comments
 (0)