[Instruction] Add dropLocation and updateLocationAfterHoist helpers
authorVedant Kumar <vsk@apple.com>
Tue, 8 Sep 2020 20:39:52 +0000 (13:39 -0700)
committerVedant Kumar <vsk@apple.com>
Thu, 24 Sep 2020 22:00:04 +0000 (15:00 -0700)
commitdfc5a9eb57aaaac972764bf731503419284bd3dc
tree9b9931297530bb707e7f7be6024f697b625e2332
parent1c5a3c4d382353e582ecf4913e338599028e267f
[Instruction] Add dropLocation and updateLocationAfterHoist helpers

Introduce a helper which can be used to update the debug location of an
Instruction after the instruction is hoisted. This can be used to safely
drop a source location as recommended by the docs.

For more context, see the discussion in https://reviews.llvm.org/D60913.

Differential Revision: https://reviews.llvm.org/D85670
llvm/include/llvm/IR/Instruction.h
llvm/lib/IR/DebugInfo.cpp
llvm/lib/Transforms/Scalar/GVN.cpp
llvm/lib/Transforms/Scalar/LICM.cpp
llvm/test/DebugInfo/Generic/licm-hoist-debug-loc.ll
llvm/test/Transforms/GVN/PRE/phi-translate.ll
llvm/test/Transforms/LICM/hoisting-preheader-debugloc.ll
llvm/unittests/IR/InstructionsTest.cpp