[flang-commits] [clang] [flang] [mlir] [Flang][Driver]Implemented the support for option -f[no-]optimize-sibling-calls in Flang (PR #216650)
Kaviya Rajendiran via flang-commits
flang-commits at lists.llvm.org
Fri Aug 28 01:51:30 PDT 2026
================
@@ -0,0 +1,14 @@
+// RUN: mlir-translate -mlir-to-llvmir %s | FileCheck %s
+
+// CHECK: define void @disable_tail_calls() #[[ATTRS_TRUE:.*]] {
+llvm.func @disable_tail_calls() attributes {disable_tail_calls = true} {
+ llvm.return
+}
+
+// CHECK: define void @disable_tail_calls_false() #[[ATTRS_FALSE:.*]] {
+llvm.func @disable_tail_calls_false() attributes {disable_tail_calls = false} {
----------------
kaviya2510 wrote:
Clang does not emit `disable-tail-calls=false` with `-foptimize-sibling-calls`. it emits the attribute only when tail-call optimization is explicitly disabled through `-fno-optimize-siblings-calls` and flang has the same behavior as clang.
The `"disable_tail_calls = false"` case in this testcase only verifies the behavior when `disable_tail_calls = false` is explicitly specified in MLIR. The purpose of this test is to ensure that the LLVM dialect exposes the attribute and lowers it correctly to LLVM IR.
https://github.com/llvm/llvm-project/pull/216650
More information about the flang-commits
mailing list