[llvm] [InstCombine] Handle more even/odd math functions (PR #81324)

Artem Tyurin via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 11 06:49:20 PST 2024


================
@@ -2797,6 +2797,21 @@ static bool insertSinCosCall(IRBuilderBase &B, Function *OrigCallee, Value *Arg,
   return true;
 }
 
+Value *LibCallSimplifier::optimizeSymmetric(CallInst *CI, bool IsEven,
+                                            IRBuilderBase &B) {
+  Value *X;
+  if (match(CI->getArgOperand(0), m_OneUse(m_FNeg(m_Value(X))))) {
+    auto *CallInst = copyFlags(*CI, B.CreateCall(CI->getCalledFunction(), {X}));
----------------
agentcooper wrote:

Done. I've added FMF flags (`reassoc`) and general flags (`tail`) to the call site in the original test.

https://github.com/llvm/llvm-project/pull/81324


More information about the llvm-commits mailing list