Created attachment 19755 [details] reproducer Running opt -S -o - foo.ll -callsite-splitting we get stuck and loop forever in function recordConditions in CallSitesplitting.cpp: /// Record ICmp conditions relevant to any argument in CS following Pred's /// single successors. If there are conflicting conditions along a path, like /// x == 1 and x == 0, the first condition will be used. static void recordConditions(CallSite CS, BasicBlock *Pred, ConditionsTy &Conditions) { recordCondition(CS, Pred, CS.getInstruction()->getParent(), Conditions); BasicBlock *From = Pred; BasicBlock *To = Pred; SmallPtrSet<BasicBlock *, 4> Visited = {From}; while (!Visited.count(From->getSinglePredecessor()) && (From = From->getSinglePredecessor())) { recordCondition(CS, From, To, Conditions); To = From; } } It looks suspicious to me that Visited isn't updated in the loop.
Thanks, I've updated the code to properly track the visited nodes https://reviews.llvm.org/rL323515
(In reply to Florian Hahn from comment #1) > Thanks, I've updated the code to properly track the visited nodes > https://reviews.llvm.org/rL323515 Thanks!
I think we should try to get this in the release branch too. I would like to wait till tomorrow with that though, so Jun can have a look before that.
The fix looks good to me. Thanks Florian.