The insertReplacementDbgValues utility helps optimization passes
preserve debug info when replacing a to-be-DCE'd value with a new value.
This patch simplifies the API by moving the responsibiliy for rewriting
dbg.value DIExpressions from individual passes into common utility code.
This should make the API easier to adopt, and allows generically useful
improvements to be made to the expression rewriting logic.
Along with the API change, this patch teaches insertReplacementDbgValues
how to create DIExpressions for basic integer and pointer conversions:
- The no-op conversion. Applies when the values have the same width, or
are bit-for-bit compatible pointer representations.
- Truncation. Applies when the new value is wider than the old one.
- Zero/sign extension. Applies when the new value is narrower than the
- check-llvm, check-clang, a stage2 `-g -O3` build of clang, and added
- This resolves a number of mis-sized dbg.value diagnostics from