[llvm-branch-commits] [llvm] f0e3d1d - [IndVars] Fix adding trunc instructions to unwind blocks

Yevgeny Rouban via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Dec 17 21:58:23 PST 2020


Author: Yevgeny Rouban
Date: 2020-12-18T12:52:23+07:00
New Revision: f0e3d1d6ca8c9c0d1191de1db90bd4906d16cb28

URL: https://github.com/llvm/llvm-project/commit/f0e3d1d6ca8c9c0d1191de1db90bd4906d16cb28
DIFF: https://github.com/llvm/llvm-project/commit/f0e3d1d6ca8c9c0d1191de1db90bd4906d16cb28.diff

LOG: [IndVars] Fix adding trunc instructions to unwind blocks

Truncate instruction must not be inserted before landing pads.
The insertion point is fixed.

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/SimplifyIndVar.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
index 189130f0e0ac..f3b198094bd1 100644
--- a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
@@ -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);


        


More information about the llvm-branch-commits mailing list