[PATCH] D129167: [AggressiveInstCombine] convert sqrt libcalls with "nnan" to sqrt intrinsics
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 26 11:12:06 PDT 2022
spatel marked an inline comment as done.
spatel added inline comments.
================
Comment at: llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp:445
+ if (!CalledFunc->getParent() || !TLI.getLibFunc(*CalledFunc, Func) ||
+ !isLibFuncEmittable(M, &TLI, Func))
+ return false;
----------------
efriedma wrote:
> Checking that `CalledFunc->getParent()` doesn't make sense; the module is never going to be null. Did you mean `!CalledFunc`?
>
> Can we use the getLibFunc() overload that takes a CallBase as an argument?
I thought I had adapted this line from the checks leading up to LibCallSimplifier::optimizeSqrt(), but you're correct - that parent check is not there.
The version that uses CallBase does look better - it includes the nobuiltin check, so we don't need to repeat it here. I can add a 'nobuiltin' regression test to confirm.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129167/new/
https://reviews.llvm.org/D129167
More information about the llvm-commits
mailing list