The insertRreplacementDbgValuesAllDbgUsesWith utility helps optimization passespasses preserve debug info when
preserve debug info when replacing a to-be-DCE'done value with a new valuenother.
This patch simplifies the API by moving the responsibiliy for rewritingimproves upon the existing insertReplacementDbgValues API by:
- Updating debug intrinsics in-place, while preventing use-before-def of
the replacement value.
dbg.value DIExpressions from individual passes into common utility code- Falling back to salvageDebugInfo when a replacement can't be made.
This should make- Moving the API easier to adopt, and allows generically usefulresponsibiliy for rewriting llvm.dbg.* DIExpressions into
improvements to be made to the expression rewriting logic common utility code.
Along with the API change, this patch teaches insertRreplacementDbgValuesAllDbgUsesWith how to
how to create DIExpressions forr three basic integer and pointer conversions:
- The no-op conversion. Applies when the values have the same width, or
have 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
old one.
Testing:
- check-llvm, check-clang, a stage2 `-g -O3` build of clang, and added
regression/unit tests.
ing.
- This resolves a number of mis-sized dbg.value diagnostics from
Debugify.