[Debuginfo] Prevent CodeGenPrepare from dropping debuginfo references.

This fixes PR39845. CodeGenPrepare employs a transactional model when 
performing optimizations, i.e. it changes the IR to attempt an optimization
and rolls back the change when it finds the change inadequate. It is during
the rollback that references to locals were dropped from debug value 
intrinsics. This patch reinstates debuginfo references during rollbacks.

Reviewers: aprantl, vsk

Differential Revision: https://reviews.llvm.org/D55396 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@348896 91177308-0d34-0410-b5e6-96231b3b80d8
2 files changed