diff options
author | Vedant Kumar <vsk@apple.com> | 2018-05-24 23:00:21 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2018-05-24 23:00:21 +0000 |
commit | 40399a213d3c494933bd903bb02dba5c1f574363 (patch) | |
tree | a22ce6751da42bef8ec1dcf8a43508ebf894d181 /llvm/lib/CodeGen/CodeGenPrepare.cpp | |
parent | 1328cf4b8dae60fc5cc904e42c4039276e7b5ead (diff) | |
download | llvm-40399a213d3c494933bd903bb02dba5c1f574363.zip llvm-40399a213d3c494933bd903bb02dba5c1f574363.tar.gz llvm-40399a213d3c494933bd903bb02dba5c1f574363.tar.bz2 |
[DebugInfo] Maintain DI when converting GEP to bitcast
When a GEP with all zero indices is converted to bitcast, its DI wasn't
copied over to the newly created instruction. This patch fixes that bug.
Patch by Kareem Ergawy!
Differential Revision: https://reviews.llvm.org/D47347
llvm-svn: 333235
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index 1b8d5b3..cafcd37 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -6559,6 +6559,7 @@ bool CodeGenPrepare::optimizeInst(Instruction *I, bool &ModifiedDT) { /// The GEP operand must be a pointer, so must its result -> BitCast Instruction *NC = new BitCastInst(GEPI->getOperand(0), GEPI->getType(), GEPI->getName(), GEPI); + NC->setDebugLoc(GEPI->getDebugLoc()); GEPI->replaceAllUsesWith(NC); GEPI->eraseFromParent(); ++NumGEPsElim; |