Skip to content

Commit 306f8db

Browse files
author
Devang Patel
committed
Preserve line number information while threading jumps.
llvm-svn: 130880
1 parent 892e993 commit 306f8db

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

llvm/lib/Transforms/Scalar/JumpThreading.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -929,9 +929,10 @@ bool JumpThreading::SimplifyPartiallyRedundantLoad(LoadInst *LI) {
929929
if (UnavailablePred) {
930930
assert(UnavailablePred->getTerminator()->getNumSuccessors() == 1 &&
931931
"Can't handle critical edge here!");
932-
Value *NewVal = new LoadInst(LoadedPtr, LI->getName()+".pr", false,
932+
LoadInst *NewVal = new LoadInst(LoadedPtr, LI->getName()+".pr", false,
933933
LI->getAlignment(),
934934
UnavailablePred->getTerminator());
935+
NewVal->setDebugLoc(LI->getDebugLoc());
935936
AvailablePreds.push_back(std::make_pair(UnavailablePred, NewVal));
936937
}
937938

@@ -944,6 +945,7 @@ bool JumpThreading::SimplifyPartiallyRedundantLoad(LoadInst *LI) {
944945
PHINode *PN = PHINode::Create(LI->getType(), std::distance(PB, PE), "",
945946
LoadBB->begin());
946947
PN->takeName(LI);
948+
PN->setDebugLoc(LI->getDebugLoc());
947949

948950
// Insert new entries into the PHI for each predecessor. A single block may
949951
// have multiple entries here.
@@ -1375,7 +1377,8 @@ bool JumpThreading::ThreadEdge(BasicBlock *BB,
13751377

13761378
// We didn't copy the terminator from BB over to NewBB, because there is now
13771379
// an unconditional jump to SuccBB. Insert the unconditional jump.
1378-
BranchInst::Create(SuccBB, NewBB);
1380+
BranchInst *NewBI =BranchInst::Create(SuccBB, NewBB);
1381+
NewBI->setDebugLoc(BB->getTerminator()->getDebugLoc());
13791382

13801383
// Check to see if SuccBB has PHI nodes. If so, we need to add entries to the
13811384
// PHI nodes for NewBB now.

0 commit comments

Comments
 (0)