[llvm] [CodeGen] Fix ShrinkWrap crash when FindIDom receives empty predecessor/successor list (PR #198995)

Elizaveta Noskova via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 1 07:21:16 PDT 2026


================
@@ -384,6 +384,8 @@ bool ShrinkWrapImpl::useOrDefCSROrFI(const MachineInstr &MI, RegScavenger *RS,
 template <typename ListOfBBs, typename DominanceAnalysis>
 static MachineBasicBlock *FindIDom(MachineBasicBlock &Block, ListOfBBs BBs,
                                    DominanceAnalysis &Dom, bool Strict = true) {
+  if (BBs.begin() == BBs.end())
----------------
enoskova-sc wrote:

When BBs are empty and `Strict == false` we should return Block itself. 

https://github.com/llvm/llvm-project/pull/198995


More information about the llvm-commits mailing list