diff options
author | Vedant Kumar <vsk@apple.com> | 2018-08-22 00:10:37 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2018-08-22 00:10:37 +0000 |
commit | 1e8a2c963c804770bb58fbbd0103da2a86217c15 (patch) | |
tree | c6e12cb0173258ea630eab6425c9c88e6094ce22 /llvm/lib/CodeGen | |
parent | 30406fd7894e57e2cda9401fad59cc7e8c655e6e (diff) | |
download | bcm5719-llvm-1e8a2c963c804770bb58fbbd0103da2a86217c15.tar.gz bcm5719-llvm-1e8a2c963c804770bb58fbbd0103da2a86217c15.zip |
[CodeGenPrepare] Set debug locations when splitting selects
When splitting a select into a diamond, set debug locations on
newly-created branch instructions and phi nodes.
llvm-svn: 340371
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index fd26345b41d..5209ddbb792 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -5680,6 +5680,7 @@ bool CodeGenPrepare::optimizeSelectInst(SelectInst *SI) { TrueBlock = BasicBlock::Create(SI->getContext(), "select.true.sink", EndBlock->getParent(), EndBlock); TrueBranch = BranchInst::Create(EndBlock, TrueBlock); + TrueBranch->setDebugLoc(SI->getDebugLoc()); } auto *TrueInst = cast<Instruction>(SI->getTrueValue()); TrueInst->moveBefore(TrueBranch); @@ -5689,6 +5690,7 @@ bool CodeGenPrepare::optimizeSelectInst(SelectInst *SI) { FalseBlock = BasicBlock::Create(SI->getContext(), "select.false.sink", EndBlock->getParent(), EndBlock); FalseBranch = BranchInst::Create(EndBlock, FalseBlock); + FalseBranch->setDebugLoc(SI->getDebugLoc()); } auto *FalseInst = cast<Instruction>(SI->getFalseValue()); FalseInst->moveBefore(FalseBranch); @@ -5703,7 +5705,8 @@ bool CodeGenPrepare::optimizeSelectInst(SelectInst *SI) { FalseBlock = BasicBlock::Create(SI->getContext(), "select.false", EndBlock->getParent(), EndBlock); - BranchInst::Create(EndBlock, FalseBlock); + auto *FalseBranch = BranchInst::Create(EndBlock, FalseBlock); + FalseBranch->setDebugLoc(SI->getDebugLoc()); } // Insert the real conditional branch based on the original condition. @@ -5738,6 +5741,7 @@ bool CodeGenPrepare::optimizeSelectInst(SelectInst *SI) { PN->takeName(SI); PN->addIncoming(getTrueOrFalseValue(SI, true, INS), TrueBlock); PN->addIncoming(getTrueOrFalseValue(SI, false, INS), FalseBlock); + PN->setDebugLoc(SI->getDebugLoc()); SI->replaceAllUsesWith(PN); SI->eraseFromParent(); |