[ConstantFolding] Eliminate atan and atan2 calls
authorMohammed Nurul Hoque <mohammed.nurulhoque@imgtec.com>
Wed, 10 Aug 2022 14:59:23 +0000 (10:59 -0400)
committerSanjay Patel <spatel@rotateright.com>
Wed, 10 Aug 2022 15:01:50 +0000 (11:01 -0400)
commit30abc1a6a18e843fd0470157d4d2ec285aaac8cd
treef17cc54e74b3d67b642fdbeaf0970c8127c84b4a
parentf5738c51452f90d7f33963d1c0c6f8e7f3d801e3
[ConstantFolding] Eliminate atan and atan2 calls

From the opengroup specifications, atan2 may fail if the result
underflows and atan may fail if the argument is subnormal, but
we assume that does not happen and eliminate the calls if we
can constant fold the result at compile-time.

Differential Revision: https://reviews.llvm.org/D127964
llvm/lib/Analysis/ConstantFolding.cpp
llvm/test/Transforms/EarlyCSE/atan.ll
llvm/test/Transforms/EarlyCSE/math-1.ll
llvm/test/Transforms/EarlyCSE/math-2.ll