[InstCombine] Create new log2 intrinsic; NFCI

Rather than mixing creation of new instructions and in-place
modification here, create a new log2 intrinsic. This should be
NFC apart from worklist order changes.
This commit is contained in:
Nikita Popov 2020-02-16 10:15:53 +01:00
parent 6cdc36afb2
commit 893c630fbe
1 changed files with 1 additions and 2 deletions

View File

@ -563,8 +563,7 @@ Instruction *InstCombiner::visitFMul(BinaryOperator &I) {
Y = Op0;
}
if (Log2) {
Log2->setArgOperand(0, X);
Log2->copyFastMathFlags(&I);
Value *Log2 = Builder.CreateUnaryIntrinsic(Intrinsic::log2, X, &I);
Value *LogXTimesY = Builder.CreateFMulFMF(Log2, Y, &I);
return BinaryOperator::CreateFSubFMF(LogXTimesY, Y, &I);
}