Fixes https://github.com/llvm/llvm-project/issues/56807
The problem occurs when the InstCombine pass removes an unnecessary BitCast but does not update the operand of the llvm.dbg.declare intrinsic call. This makes the llvm.dbg.declare have undef as its operand, but the problem can go away if we replace debug uses of the old alloca in the new alloca.
Tests for metadata nodes ("!7", "!12") shouldn't test the explicit number, because those can change when other parts of LLVM change, and we should avoid spurious test failures. Instead, it's best to capture the metadata numbers and check that they correspond to the right metadata node -- there's an example in D133095.