[IndVars] Fix adding trunc instructions to unwind blocks

Truncate instruction must not be inserted before landing pads.
The insertion point is fixed.
This commit is contained in:
Yevgeny Rouban 2020-12-18 12:47:13 +07:00
parent d3bf0bb189
commit f0e3d1d6ca
1 changed files with 1 additions and 1 deletions

View File

@ -1654,7 +1654,7 @@ bool WidenIV::widenWithVariantUse(WidenIV::NarrowIVDefUse DU) {
assert(LoopExitingBlock && L->contains(LoopExitingBlock) &&
"Not a LCSSA Phi?");
WidePN->addIncoming(WideBO, LoopExitingBlock);
Builder.SetInsertPoint(User->getParent()->getFirstNonPHI());
Builder.SetInsertPoint(&*User->getParent()->getFirstInsertionPt());
auto *TruncPN = Builder.CreateTrunc(WidePN, User->getType());
User->replaceAllUsesWith(TruncPN);
DeadInsts.emplace_back(User);