[InstCombine] Set MadeIRChange in replaceInstUsesWith.
authorFlorian Hahn <flo@fhahn.com>
Sat, 23 Jan 2021 17:42:18 +0000 (17:42 +0000)
committerFlorian Hahn <flo@fhahn.com>
Sat, 23 Jan 2021 17:52:59 +0000 (17:52 +0000)
commitd60b74c28a076062259ba8a8b80a9bdd802c7497
treeeac621afc2dffb2f851fa19514cd2b2a5a059cdb
parenta8e06361ddba6a25fb0c27596aaa03c5423d1868
[InstCombine] Set MadeIRChange in replaceInstUsesWith.

Some utilities used by InstCombine, like SimplifyLibCalls, may add new
instructions and replace the uses of a call, but return nullptr because
the inserted call produces multiple results.

Previously, the replaced library calls would get removed by
InstCombine's deleter, but after
292077072ec1279d89d21873fe900061e55ef936 this may not happen, if the
willreturn attribute is missing.

As a work-around, update replaceInstUsesWith to set MadeIRChange, if it
replaces any uses. This catches the cases where it is used as replacer
by utilities used by InstCombine and seems useful in general; updating
uses will modify the IR.

This fixes an expensive-check failure when replacing
@__sinpif/@__cospifi with @__sincospif_sret.
llvm/lib/Transforms/InstCombine/InstCombineInternal.h