[PATCH] D41283: [WIP][InstCombine] Missed optimization in math expression: tan(a) * cos(a) == sin(a)
Hal Finkel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 19 20:06:56 PST 2017
hfinkel added inline comments.
================
Comment at: lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:728
+ StringRef TanName = TanCallee->getName();
+ if (Cos->getIntrinsicID() == Intrinsic::cos && TanName == "tan" &&
+ Cos->getArgOperand(0) == Tan->getArgOperand(0)) {
----------------
Please see my comments in D41389 about names.
================
Comment at: lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:731
+ Value *Sin = Intrinsic::getDeclaration(I.getModule(), Intrinsic::sin, I.getType());
+ Builder.setFastMathFlags(I.getFastMathFlags());
+ Value *SinCall = Builder.CreateCall(Sin, Cos->getArgOperand(0), "sin");
----------------
Needs
BuilderTy::FastMathFlagGuard Guard(Builder);
above this.
https://reviews.llvm.org/D41283
More information about the llvm-commits
mailing list