diff options
author | Vedant Kumar <vsk@apple.com> | 2019-11-07 11:19:41 -0800 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2019-11-07 11:19:41 -0800 |
commit | a087b78bc4c31be5a82eda62f1e4c7fe1fec14ad (patch) | |
tree | 075175a773611e7a5a71fcfe899359ad6e5fc52a /llvm/lib/Transforms/InstCombine/InstCombineInternal.h | |
parent | ff9d732887385e6f3e516769419dd64b406d81d8 (diff) | |
download | bcm5719-llvm-a087b78bc4c31be5a82eda62f1e4c7fe1fec14ad.tar.gz bcm5719-llvm-a087b78bc4c31be5a82eda62f1e4c7fe1fec14ad.zip |
Wrong debug info generated at -O2 (-O0 is correct)
Instcombiner pass was erasing trivially dead instruction without updating dependent llvm.dbg.value.
which was not showing programmer current state of variables while debugging.
As a part of this fix I did following,
Iterate throught all the users (llvm.dbg) of a instruction which is trivially dead and set each if them undef, Before deleting the instruction.
Now user will see optimized out, when try to print those variables.
This fixes
https://bugs.llvm.org/show_bug.cgi?id=43893
This is my first fix to llvm.
Patch by kamlesh kumar!
Differential Revision: https://reviews.llvm.org/D69809
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineInternal.h')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineInternal.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h index 1dbc06d92e7..aabedbda7e6 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h +++ b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h @@ -705,7 +705,7 @@ public: Instruction *eraseInstFromFunction(Instruction &I) { LLVM_DEBUG(dbgs() << "IC: ERASE " << I << '\n'); assert(I.use_empty() && "Cannot erase instruction that is used!"); - salvageDebugInfo(I); + salvageDebugInfoOrMarkUndef(I); // Make sure that we reprocess all operands now that we reduced their // use counts. |