[llvm] r328372 - [InstCombine] simplify code for FP intrinsic shrinking; NFCI
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 23 14:18:12 PDT 2018
Author: spatel
Date: Fri Mar 23 14:18:12 2018
New Revision: 328372
URL: http://llvm.org/viewvc/llvm-project?rev=328372&view=rev
Log:
[InstCombine] simplify code for FP intrinsic shrinking; NFCI
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=328372&r1=328371&r2=328372&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp Fri Mar 23 14:18:12 2018
@@ -2070,17 +2070,12 @@ Instruction *InstCombiner::visitCallInst
case Intrinsic::rint:
case Intrinsic::trunc: {
Value *ExtSrc;
- if (match(II->getArgOperand(0), m_FPExt(m_Value(ExtSrc))) &&
- II->getArgOperand(0)->hasOneUse()) {
- // fabs (fpext x) -> fpext (fabs x)
- Value *F = Intrinsic::getDeclaration(II->getModule(), II->getIntrinsicID(),
- { ExtSrc->getType() });
- CallInst *NewFabs = Builder.CreateCall(F, ExtSrc);
- NewFabs->copyFastMathFlags(II);
- NewFabs->takeName(II);
- return new FPExtInst(NewFabs, II->getType());
+ if (match(II->getArgOperand(0), m_OneUse(m_FPExt(m_Value(ExtSrc))))) {
+ // Narrow the call: intrinsic (fpext x) -> fpext (intrinsic x)
+ Value *NarrowII = Builder.CreateIntrinsic(II->getIntrinsicID(),
+ { ExtSrc }, II);
+ return new FPExtInst(NarrowII, II->getType());
}
-
break;
}
case Intrinsic::cos:
More information about the llvm-commits
mailing list