Manuel Carrasco ee6f5f386f
[InstCombine] Replace alloca with undef size with poison instead of null (#182919)
InstCombine previously replaced an alloca instruction with a null
pointer when the array size operand was undef. While this replacement
may be legal, it still caused invalid IR in cases where the original
alloca was used by `@llvm.lifetime` intrinsics.

The spec requires that the pointer operand of `@llvm.lifetime.*` must be
either:

- a pointer to an alloca instruction, or
- a poison value.

Replacing the pointer with null violated this requirement and triggered
verifier errors.

These new changes update InstCombine so that in this scenario the alloca
is replaced with poison instead of null.
2026-02-27 19:13:57 +00:00
..