From e3fb157234c40dfa2746dbb08edd8730cc4b78c4 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 10 Sep 2022 20:52:08 +0200 Subject: Vendor import of llvm-project branch release/15.x llvmorg-15.0.0-0-g4ba6a9c9f65b (aka 15.0.0 release). --- llvm/lib/Transforms/Utils/LoopUtils.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Transforms/Utils/LoopUtils.cpp') diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp index 349063dd5e89..bbba76a5c5ef 100644 --- a/llvm/lib/Transforms/Utils/LoopUtils.cpp +++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp @@ -1394,7 +1394,10 @@ int llvm::rewriteLoopExitValues(Loop *L, LoopInfo *LI, TargetLibraryInfo *TLI, // and next SCEV may errneously get smaller cost. // Collect all the candidate PHINodes to be rewritten. - RewritePhiSet.emplace_back(PN, i, ExitValue, Inst, HighCost); + Instruction *InsertPt = + (isa(Inst) || isa(Inst)) ? + &*Inst->getParent()->getFirstInsertionPt() : Inst; + RewritePhiSet.emplace_back(PN, i, ExitValue, InsertPt, HighCost); } } } -- cgit v1.2.3