The edge `StartBlock -> EndBlock` already exists before unfolding. The instructions for `applyUpdates()` say that you are supposed not to insert an existing edge. Fixes issues reported by @mikaelholmen in https://github.com/llvm/llvm-project/pull/162802