[Windows SEH] Fix crash on empty seh block (#107031)
commitf0010d131b79a1b401777aa32e96defc4a935c9d
authorR-Goc <131907007+R-Goc@users.noreply.github.com>
Wed, 4 Sep 2024 18:10:36 +0000 (4 20:10 +0200)
committerTobias Hieta <tobias@hieta.se>
Fri, 13 Sep 2024 06:05:50 +0000 (13 08:05 +0200)
treeccb799da1d4cb197dc1eede867738d539db83afc
parent93998aff7662d9b3f94d9627179dffe342e2b399
[Windows SEH] Fix crash on empty seh block (#107031)

Fixes https://github.com/llvm/llvm-project/issues/105813 and
https://github.com/llvm/llvm-project/issues/106915.
Adds a check for the end of the iterator, which can be a sentinel.
The issue was introduced in
https://github.com/llvm/llvm-project/commit/0efe111365ae176671e01252d24028047d807a84
from what I can see, so along with the introduction of /EHa support.

(cherry picked from commit 2e0ded3371f8d42f376bdfd4d70687537e36818e)
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
llvm/test/CodeGen/WinEH/wineh-empty-seh-scope.ll [new file with mode: 0644]