While I was updating the Julia frontend for LLVM 6.0.0 I encountered a situation
where we emitted code that triggered the diamond conversion in if-converter while
TrueBB and FalseBB terminated in ret.
BB / \ TrueBB FalseBB ... ... ret ret
The if-converter pass decided that this was a valid structure to do a diamond conversion on
and this triggered an assertion later on since if-converter implictly assumed that TrueBB and
FalseBB terminate in a branch or a fall-trough. Since the situation described above is equivalent
BB / \ TrueBB FalseBB ... ... \ / BB ret
I think it is reasonable for if-converter to do a diamond conversion on and so this PR adds a bit handling for
return (treating returns as a form of an unconditional branch).
This fixes https://bugs.llvm.org/show_bug.cgi?id=36825