[PATCH] D107872: [SimplifyLibCalls] propagate tail/musttail/notail flags on CallInsts

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 12 15:26:02 PDT 2021


nickdesaulniers added a comment.

In D107872#3059254 <https://reviews.llvm.org/D107872#3059254>, @xbolva00 wrote:

> If we replace musttail CI with non-CI or CI without musttail, maybe we should have an assert somewhere to detect this issue for new libcall simplifications

Done. PTAL @ `assert`s added to `InstCombinerImpl::tryOptimizeCall` in `llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp`.



================
Comment at: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp:1643
     Function *FAbsFn = Intrinsic::getDeclaration(Mod, Intrinsic::fabs, Ty);
-    Sqrt = B.CreateCall(FAbsFn, Sqrt, "abs");
+    Sqrt = copyFlags(*Pow, B.CreateCall(FAbsFn, Sqrt, "abs"));
   }
----------------
jdoerfert wrote:
> copy flags only if not musstail or we actually return "this Sqrt".
This case is tricky. Please review my changes here and to llvm/test/Transforms/InstCombine/pow-1.ll carefully. I think I have it right though, since the below transforms replace the call to `pow` with non-`CallInst`s, while above are `CallInsts`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107872/new/

https://reviews.llvm.org/D107872



More information about the llvm-commits mailing list