summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-11-06 16:23:03 +0000
committerSanjay Patel <spatel@rotateright.com>2018-11-06 16:23:03 +0000
commit1b85f00201382b375b77d8a57adc8d4edceacee2 (patch)
tree19df4f8c984d120744809df786101bdaefe5203e /llvm/lib
parent6aea3071e87c7270631ea3799eccbe75b119289c (diff)
downloadbcm5719-llvm-1b85f00201382b375b77d8a57adc8d4edceacee2.tar.gz
bcm5719-llvm-1b85f00201382b375b77d8a57adc8d4edceacee2.zip
[InstCombine] propagate fast-math-flags when folding fcmp+fpext
llvm-svn: 346240
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index c1c904b331a..2ff10f4fc40 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -5483,11 +5483,13 @@ Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) {
}
}
- // fcmp (fpext x), (fpext y) -> fcmp x, y
- if (FPExtInst *LHSExt = dyn_cast<FPExtInst>(Op0))
- if (FPExtInst *RHSExt = dyn_cast<FPExtInst>(Op1))
- if (LHSExt->getSrcTy() == RHSExt->getSrcTy())
- return new FCmpInst(Pred, LHSExt->getOperand(0), RHSExt->getOperand(0));
+ // fcmp (fpext X), (fpext Y) -> fcmp X, Y
+ if (match(Op0, m_FPExt(m_Value(X))) && match(Op1, m_FPExt(m_Value(Y))) &&
+ X->getType() == Y->getType()) {
+ Instruction *NewFCmp = new FCmpInst(Pred, X, Y);
+ NewFCmp->copyFastMathFlags(&I);
+ return NewFCmp;
+ }
if (I.getType()->isVectorTy())
if (Instruction *Res = foldVectorCmp(I, Builder))
OpenPOWER on IntegriCloud