[PATCH] D136098: InstCombine: Fold fdiv nnan x, 0 -> copysign(inf, x)
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 17 14:21:23 PDT 2022
spatel added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:1389
+ if (I.hasNoNaNs() && match(I.getOperand(1), m_Zero())) {
+ IRBuilder<> B(&I);
+ // TODO: nnan nsz X / -0.0 -> copysign(inf, X)
----------------
If we're changing this function from static to a member of InstCombinerImpl, then we can use the already instantiated IRBuilder for the class, so it'd be something like:
CallInst *CopySign = Builder.CreateIntrinsic(...);
Alternatively, we can leave this function static and use the raw creator API:
Function *F = Intrinsic::getDeclaration(I.getModule(), Intrinsic::copysign, C->getType());
return CallInst::Create(F, {Infinity, I.getOperand(0)});
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136098/new/
https://reviews.llvm.org/D136098
More information about the llvm-commits
mailing list