[llvm] [LICM] Allow hoisting of InsertElementInst's past non-hoistable InsertElementInsts (PR #200532)
Ryan Buchner via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 1 14:51:04 PDT 2026
================
@@ -1058,6 +1074,87 @@ bool llvm::hoistRegion(DomTreeNode *N, AAResults *AA, LoopInfo *LI,
return Changed;
}
+static bool hoistInsertPastInsert(
+ InsertElementInst *Ins, Loop *CurLoop, AAResults *AA, DominatorTree *DT,
+ const TargetLibraryInfo *TLI, BasicBlock *Preheader, BasicBlock *HoistDest,
+ ICFLoopSafetyInfo *SafetyInfo, MemorySSAUpdater &MSSAU, AssumptionCache *AC,
+ ScalarEvolution *SE, SinkAndHoistLICMFlags &Flags,
+ OptimizationRemarkEmitter *ORE,
+ SmallVectorImpl<Instruction *> &HoistedInstructions,
+ bool AllowSpeculation) {
+ SmallSet<uint64_t, 4> SeenIndexes;
+ InsertElementInst *Inner;
+ auto CanBypass = [&](auto &CanBypass, InsertElementInst *CurrIns,
+ bool IsHoistedInstruction) -> bool {
----------------
bababuck wrote:
I think I've used this elsewhere in LLVM before, though not sure if that work ever made it upstream. Will change to static function.
https://github.com/llvm/llvm-project/pull/200532
More information about the llvm-commits
mailing list