summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorAnastasis Grammenos <anastasis.gramm2@gmail.com>2018-08-07 20:21:56 +0000
committerAnastasis Grammenos <anastasis.gramm2@gmail.com>2018-08-07 20:21:56 +0000
commit52d5283483cb21c0512b432d9beea3c4dc1f45b3 (patch)
treed42892eb8b649177bf00d660e2738c9b5fe085b9 /llvm/lib
parent7fb68d267904f8de84d6b0a46de9ba15ffbd2bc1 (diff)
downloadbcm5719-llvm-52d5283483cb21c0512b432d9beea3c4dc1f45b3.tar.gz
bcm5719-llvm-52d5283483cb21c0512b432d9beea3c4dc1f45b3.zip
[Local] Add dbg location on unreachable inst in changeToUnreachable
As show in https://bugs.llvm.org/show_bug.cgi?id=37960 it would be desirable to have debug location in the unreachable instruction. Also adds a unti test for this function. Differential Revision: https://reviews.llvm.org/D50340 llvm-svn: 339173
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index d5c54ccc82c..7e607f17fc0 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -1930,7 +1930,8 @@ unsigned llvm::changeToUnreachable(Instruction *I, bool UseLLVMTrap,
CallInst *CallTrap = CallInst::Create(TrapFn, "", I);
CallTrap->setDebugLoc(I->getDebugLoc());
}
- new UnreachableInst(I->getContext(), I);
+ auto *UI = new UnreachableInst(I->getContext(), I);
+ UI->setDebugLoc(I->getDebugLoc());
// All instructions after this are dead.
unsigned NumInstrsRemoved = 0;
OpenPOWER on IntegriCloud