[clang] [Clang] Fix unnecessary extra return block emmited during function epilog after musttail call (PR #134282)

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 3 13:04:25 PDT 2025


================
@@ -3897,6 +3897,13 @@ void CodeGenFunction::EmitFunctionEpilog(const CGFunctionInfo &FI,
     return;
   }
 
+  // If there is no valid insert point, we won't emit a return.
+  // The insert point could be null if we have already emitted a return
+  // (e.g. if musttail)
+  if (!HaveInsertPoint()) {
----------------
rnk wrote:

This patch could use tests in general, and I wanted to add, you should be able to cover this case with a musttail call in a void-returning function, which should exercise one of the paths above.

https://github.com/llvm/llvm-project/pull/134282


More information about the cfe-commits mailing list