summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms')
-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