[SimplifyLibCalls] Skip unused calls in sincos transform
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 22 Jan 2021 19:44:44 +0000 (20:44 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 22 Jan 2021 19:57:13 +0000 (20:57 +0100)
commit45b259f99509dda6820e09369d84c21d4ea33bcd
treee62db02a4e5661e2041a8c70ac3ac2ad32858787
parentfaa440786ccf0c2846385c882426d207acbab49c
[SimplifyLibCalls] Skip unused calls in sincos transform

If the call result is unused, we should let it get DCEd rather
than replacing it. Also, don't try to replace an existing sincos
with another one (unless it's as part of combining sin and cos).

This avoids an infinite combine loop if the calls are not DCEd
as expected, which can happen with D94106 and lack of willreturn
annotation in hand-crafted IR.
llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp