Question about the IR code of conditional flow

I used llvm.org/demo to generate IR code from c code.
And I found that: when "return " statement appears several times in different conditional block, IR code does not genrate one "ret " instruction for each return statement,
it just put a phi node instruction at the end of the function. Just like this:
int factorial(int X) {
if (X <100)
X*=3;
else
X += 1;
return X + 3;
}
the IR code genrated would be as follow:

define i32 @factorial(i32 %X) nounwind uwtable readnone {
  %1 = icmp slt i32 %X, 100
  br i1 %1, label %2, label %4

; <label>:2                                       ; preds = %0
  %3 = mul nsw i32 %X, 3
  br label %6

; <label>:4                                       ; preds = %0
  %5 = add nsw i32 %X, 1
  br label %6

; <label>:6                                       ; preds = %4, %2
  %.0 = phi i32 [ %3, %2 ], [ %5, %4 ]
  %7 = add nsw i32 %.0, 3
  ret i32 %7
}
Is there any reason or rull to do like this, to use one phi instruction and only one ret instruction?
As I am trying to generate llvm IR code for my language, can I put each each ret at each conditional block like follows?

; <label>:2                                       ; preds = %0
  %3 = mul nsw i32 %X, 3
  ret %3
 ; <label>:4                                       ; preds = %0
  %5 = add nsw i32 %X, 1
  ret %5

Yes, feel free to generate ret instructions wherever they seem
appropriate; there isn't any restriction on the number of ret
instructions in a function.

-Eli

I used llvm.org/demo to generate IR code from c code.
And I found that: when "return " statement appears several times in different conditional block, IR code does not genrate one "ret " instruction for each return statement,
it just put a phi node instruction at the end of the function. Just like this:

The code is most likely being transformed by an LLVM pass which modifies each function to have a single return instruction.

Several compiler algorithms assume that a function has a single exit; the transform changes a function to meet this assumption.

As Eli has already stated, you can put as many returns in your functions as you like (as long as they’re at the end of basic blocks).

– John T.