[llvm] [Analysis] Attribute Range should not prevent tail call optimization (PR #91122)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue May 7 11:20:33 PDT 2024


================
@@ -28,6 +28,24 @@ define range(i64 0, 8) i64 @testmsxs(float %x) {
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    jmp llroundf at PLT # TAILCALL
     entry:
-        %0 = tail call i64 @llvm.llround.f32(float %x)
-   ret i64 %0
+        %ret = tail call i64 @llvm.llround.f32(float %x)
+   ret i64 %ret
+}
+
+declare i32 @callee()
+
+define range(i32 0, 2) i32 @func_with_range_attr() {
+; CHECK-LABEL: func_with_range_attr:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    jmp callee at PLT # TAILCALL
+    %1 = musttail call i32 @callee()
+      ret i32 %1
+}
+
+define i32 @call_with_range_attr() {
+; CHECK-LABEL: call_with_range_attr:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    jmp callee at PLT # TAILCALL
+    %1 = musttail call range(i32 0, 2) i32 @callee()
+      ret i32 %1
----------------
arsenm wrote:

Ditto, indentation and named 

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


More information about the llvm-commits mailing list