[InstCombine] Handle PHI nodes in isOnlyCopiedFromConstantMemory()
authorAnshil Gandhi <Anshil.Gandhi@amd.com>
Wed, 11 Jan 2023 15:59:21 +0000 (16:59 +0100)
committerNikita Popov <npopov@redhat.com>
Wed, 11 Jan 2023 16:24:41 +0000 (17:24 +0100)
commit42ab5dc5a5dd6c79476104bdc921afa2a18559cf
treeef9f2d8059a6061b9eb7ff96ab57baaed066191b
parentca848557865272046901c1de1e7e9ba8c9cc3137
[InstCombine] Handle PHI nodes in isOnlyCopiedFromConstantMemory()

As long as the memcpy occurs on a phi input (rather than the phi
output), we can look through phi nodes in
isOnlyCopiedFromConstantMemory().

This is split out of D136201, to only handle the case where the
address spaces are the same, and no pointer rewrite is necessary.
llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
llvm/test/Transforms/InstCombine/replace-alloca-phi.ll