Detect stack overflow

Hi All,

What is the best way of detecting stack overflow(for example shown below) using LLVM?

define void @foo() unnamed_addr #1 {
start:
call void @bar()
br label %bb1
bb1:
ret void
}

Thank you,
Kavindu

Hi all,

Please note that the above example is wrong. This is the correct example, sorry for the confusion.