Interestingly, this code is so similar that if you put them in three different functions it will create the first one and have the other two delegate to that one: Compiler Explorer
(As an aside, does the Swift compiler have an equivalent for -fomit-frame-pointer?)
How switches and ifs get lowered is generally up to llvm. It can canonicalize either form to the other, depending on what its heuristics guess is best. For equivalent control flow, in theory you should end up with the same output, and like @saagarjha observed, the identical implementations can then be folded into one function.