[llvm] r291965 - [CodeGen] Simplify getRecipEstimateForFunc

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 13 14:24:25 PST 2017


Author: majnemer
Date: Fri Jan 13 16:24:25 2017
New Revision: 291965

URL: http://llvm.org/viewvc/llvm-project?rev=291965&view=rev
Log:
[CodeGen] Simplify getRecipEstimateForFunc

It used two attribute lookups when only one was needed.

Modified:
    llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp

Modified: llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp?rev=291965&r1=291964&r2=291965&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp Fri Jan 13 16:24:25 2017
@@ -1918,11 +1918,7 @@ void TargetLoweringBase::setMaximumJumpT
 /// override the target defaults.
 static StringRef getRecipEstimateForFunc(MachineFunction &MF) {
   const Function *F = MF.getFunction();
-  StringRef RecipAttrName = "reciprocal-estimates";
-  if (!F->hasFnAttribute(RecipAttrName))
-    return StringRef();
-
-  return F->getFnAttribute(RecipAttrName).getValueAsString();
+  return F->getFnAttribute("reciprocal-estimates").getValueAsString();
 }
 
 /// Construct a string for the given reciprocal operation of the given type.




More information about the llvm-commits mailing list