File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
llvm/lib/Transforms/Scalar Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -602,7 +602,9 @@ bool CodeGenPrepare::DupRetToEnableTailCallOpts(ReturnInst *RI) {
602
602
if (&*BI != RI)
603
603
return false ;
604
604
} else {
605
- if (&*BB->begin () != RI)
605
+ BasicBlock::iterator BI = BB->begin ();
606
+ while (isa<DbgInfoIntrinsic>(BI)) ++BI;
607
+ if (&*BI != RI)
606
608
return false ;
607
609
}
608
610
@@ -626,10 +628,12 @@ bool CodeGenPrepare::DupRetToEnableTailCallOpts(ReturnInst *RI) {
626
628
BasicBlock::InstListType &InstList = (*PI)->getInstList ();
627
629
BasicBlock::InstListType::reverse_iterator RI = InstList.rbegin ();
628
630
BasicBlock::InstListType::reverse_iterator RE = InstList.rend ();
629
- if (++RI == RE)
631
+ do { ++RI; } while (RI != RE && isa<DbgInfoIntrinsic>(&*RI));
632
+ if (RI == RE)
630
633
continue ;
634
+
631
635
CallInst *CI = dyn_cast<CallInst>(&*RI);
632
- if (CI && CI->getType ()-> isVoidTy () && TLI->mayBeEmittedAsTailCall (CI))
636
+ if (CI && CI->use_empty () && TLI->mayBeEmittedAsTailCall (CI))
633
637
TailCalls.push_back (CI);
634
638
}
635
639
}
You can’t perform that action at this time.
0 commit comments