summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/InlineCost.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index a332a439007..3cb56f8cccf 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -273,6 +273,7 @@ class CallAnalyzer : public InstVisitor<CallAnalyzer, bool> {
bool visitCmpInst(CmpInst &I);
bool visitSub(BinaryOperator &I);
bool visitBinaryOperator(BinaryOperator &I);
+ bool visitFNeg(UnaryOperator &I);
bool visitLoad(LoadInst &I);
bool visitStore(StoreInst &I);
bool visitExtractValue(ExtractValueInst &I);
@@ -1106,6 +1107,28 @@ bool CallAnalyzer::visitBinaryOperator(BinaryOperator &I) {
return false;
}
+bool CallAnalyzer::visitFNeg(UnaryOperator &I) {
+ Value *Op = I.getOperand(0);
+ Constant *COp = dyn_cast<Constant>(Op);
+ if (!COp)
+ COp = SimplifiedValues.lookup(Op);
+
+ Value *SimpleV = SimplifyFNegInst(COp ? COp : Op,
+ cast<FPMathOperator>(I).getFastMathFlags(),
+ DL);
+
+ if (Constant *C = dyn_cast_or_null<Constant>(SimpleV))
+ SimplifiedValues[&I] = C;
+
+ if (SimpleV)
+ return true;
+
+ // Disable any SROA on arguments to arbitrary, unsimplified fneg.
+ disableSROA(Op);
+
+ return false;
+}
+
bool CallAnalyzer::visitLoad(LoadInst &I) {
Value *SROAArg;
DenseMap<Value *, int>::iterator CostIt;
OpenPOWER on IntegriCloud