[Mem2Reg] Consistently preserve nonnull assume for uninit load
authorNikita Popov <npopov@redhat.com>
Tue, 12 Jul 2022 10:38:52 +0000 (12:38 +0200)
committerNikita Popov <npopov@redhat.com>
Tue, 12 Jul 2022 10:53:08 +0000 (12:53 +0200)
commit3d475dfeb990df5c112535ecc4ec6ffc8f18d4b1
treecdea18cc51a538a3cd2f94dab9356a541d58b4df
parent3cfa32a71ecfbc1bf993358e32b916cf3483299f
[Mem2Reg] Consistently preserve nonnull assume for uninit load

When performing a !nonnull load from uninitialized memory, we
should preserve the nonnull assume just like in all other cases.
We already do this correctly in the generic mem2reg code, but
don't handle this case when using the optimized single-block
implementation.

Make sure that the optimized implementation exhibits the same
behavior as the generic implementation.
llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
llvm/test/Transforms/Mem2Reg/preserve-nonnull-load-metadata.ll